Skip to content

Commit

Permalink
Make sure saving backup on VxCentralScan doesn't crash app when no USB
Browse files Browse the repository at this point in the history
Also clear error message on subsequent backup attempts
  • Loading branch information
arsalansufi committed Oct 6, 2023
1 parent f5b1f7f commit 4063b4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export function AdminActionsScreen({

function saveBackup() {
setIsBackingUp(true);
setBackupError('');
exportCastVoteRecordsToUsbDriveMutation.mutate(
{ isMinimalExport: false },
{
Expand Down
5 changes: 4 additions & 1 deletion libs/backend/src/cast_vote_records/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import {
assert,
assertDefined,
err,
ok,
Result,
throwIllegalValue,
Expand Down Expand Up @@ -673,7 +674,9 @@ export async function exportCastVoteRecordsToUsbDrive(
? usbDriveStatus.mountPoint
: undefined;
}
assert(usbMountPoint !== undefined);
if (usbMountPoint === undefined) {
return err({ type: 'missing-usb-drive' });
}
const exportContext: ExportContext = {
exporter: new Exporter({
allowedExportPatterns: SCAN_ALLOWED_EXPORT_PATTERNS,
Expand Down

0 comments on commit 4063b4f

Please sign in to comment.