error handling

This commit is contained in:
Will Scullin 2021-04-24 18:23:31 -07:00
parent bebe0739c3
commit a5e5e41e3c
No known key found for this signature in database
GPG Key ID: 26DCD1042C6638CD

View File

@ -322,7 +322,12 @@ function doLoadLocal(drive: DriveNumber, file: File, options: Partial<LoadOption
const addressInput = document.querySelector<HTMLInputElement>('#local_file_address');
const addressStr = addressInput?.value;
if (addressStr) {
doLoadBinary(file, { address: parseInt(addressStr, 16), ...options });
const address = parseInt(addressStr, 16);
if (isNaN(address)) {
openAlert('Invalid address: ' + addressStr);
return;
}
doLoadBinary(file, { address, ...options });
} else {
openAlert('Unknown file type: ' + ext);
}