Correctly handle files that contain no slides

Otherwise, on reloading sent would segfault. Move the check-logic to
load() rather than doing it in main() to prevent other misuses of it in
the future.
This commit is contained in:
Laslo Hunhold 2017-09-07 11:01:10 +02:00 committed by Markus Teich
parent 53541ee1bd
commit a5f760fa0e
1 changed files with 3 additions and 3 deletions

6
sent.c
View File

@ -457,6 +457,9 @@ load(FILE *fp)
if (!p)
break;
}
if (!slidecount)
die("sent: No slides in file");
}
void
@ -695,9 +698,6 @@ main(int argc, char *argv[])
load(fp);
fclose(fp);
if (!slidecount)
usage();
xinit();
run();