markjamesm / MusicSharp

MusicSharp is a lightweight TUI music player written in C#.
https://markjames.dev/blog/developing-a-cli-music-player-csharp/
GNU General Public License v3.0
57 stars 11 forks source link

Pressing enter when not having valid file selected and having no previous valid file selected causes crash #26

Closed DomDom3333 closed 3 years ago

DomDom3333 commented 3 years ago

Steps to Recreate:

Ensure no Valid file has previously selected Open Application Press F1 to Open File Select Path (Or otherwise no valid File) Press Enter Crash

Possible Solutions:

Check if File is valid inside OpenFile(string path) in WinPlayer.cs Line 39 Check if LastFileOpened is empty/exists before telling it to open it at Tui.cs Line 214

Ideally both should probably be added.

markjamesm commented 3 years ago

Many thanks for catching this! I entered an invalid file (C:\test.exe) into the open file dialog and the app crashed with the following exception in WinPlayer.cs line 41

Winplayer error message

System.IO.FileNotFoundException HResult=0x80070002 Message=The system cannot find the file specified. (0x80070002) Source= StackTrace:

markjamesm commented 3 years ago

This issue has now been solved as of PR #29