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:
committed by
Markus Teich
parent
53541ee1bd
commit
a5f760fa0e
6
sent.c
6
sent.c
@@ -457,6 +457,9 @@ load(FILE *fp)
|
|||||||
if (!p)
|
if (!p)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!slidecount)
|
||||||
|
die("sent: No slides in file");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -695,9 +698,6 @@ main(int argc, char *argv[])
|
|||||||
load(fp);
|
load(fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
if (!slidecount)
|
|
||||||
usage();
|
|
||||||
|
|
||||||
xinit();
|
xinit();
|
||||||
run();
|
run();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user