Skip to content

Commit

Permalink
Check file exists before attempting flash (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored Jan 7, 2024
1 parent be92a03 commit f6baf36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions macos/QMK Toolbox/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ class MainViewController: NSViewController, USBListenerDelegate {
return
}

guard FileManager.default.fileExists(atPath: file) else {
logTextView.logError("File does not exist")
return
}

guard mcuBox.indexOfSelectedItem > 0 else {
logTextView.logError("Please select a microcontroller")
return
Expand Down
6 changes: 6 additions & 0 deletions windows/QMK Toolbox/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ private async void FlashAllAsync()
return;
}

if (!File.Exists(filePath))
{
logTextBox.LogError("File does not exist!");
return;
}

if (!windowState.AutoFlashEnabled)
{
Invoke(new Action(DisableUI));
Expand Down

0 comments on commit f6baf36

Please sign in to comment.