Skip to content

Commit

Permalink
Added error checking when opening a screenshot file
Browse files Browse the repository at this point in the history
  • Loading branch information
ata4 committed Aug 27, 2017
1 parent cf14c95 commit 24adcb5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/vi.c
Expand Up @@ -120,6 +120,11 @@ static void vi_screenshot_write(char* path, int32_t* buffer, int width, int heig

FILE* fp = fopen(path, "wb");

if (!fp) {
msg_warning("Can't open screenshot file %s!", path);
return;
}

// write bitmap headers
fwrite(&fhdr, sizeof(fhdr), 1, fp);
fwrite(&ihdr, sizeof(ihdr), 1, fp);
Expand Down

2 comments on commit 24adcb5

@ata4
Copy link
Owner Author

@ata4 ata4 commented on 24adcb5 Aug 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you're /u/OpenEmu on Reddit? Anyway, issues have been enabled now. 😃

@clobber
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you're /u/OpenEmu on Reddit? Anyway, issues have been enabled now.

Nope, that's me :P

Please sign in to comment.