codythegreat / dss

Dead Simple Slides - A terminal based presentation tool with Vim style keybindings
MIT License
54 stars 3 forks source link

File Error Handling #25

Closed codythegreat closed 5 years ago

codythegreat commented 5 years ago

File Error Handling

Currently if the file is not read properly in main the program will print a message stating that the file name could not be read, and a seg fault will follow. This should be handled more gracefully.

  1. A file read error should state and error as it does now, but there should also be a call to return EXIT_FAILURE;
  2. We should stop the program from continuing to the point that a seg fault happens

I propose that we add a return statement in before the seg fault in the code.

evlnyng commented 5 years ago

Hi! I'd like to give this a shot.

codythegreat commented 5 years ago

@evlnyng Hi thanks for taking a interest in this issue. I actually just pushed a commit that fixes this, but I try to post issues pretty regularly, so if you'd like to help out check back a little latter today and I should have some more issues posted.

I don't think anyone has done a grammar/verbiage sweep on the roadmap yet, so if you'd like to do that that could also be helpful.

codythegreat commented 5 years ago

commit that fixed this is 99dccaf07c3fd3225269552187e9fc5bc2b3fa7c. Solution was to move the call to initDisplay() after opening the file. if the file failed, the program would return without an ncurses session hanging in the background. If the file opened successfully, main would go ahead with initializing the display, parsing the file, and beginning display loop