summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaslo Hunhold <dev@frign.de>2017-09-07 11:01:10 +0200
committerMarkus Teich <teichm@fs.tum.de>2017-09-07 23:37:00 +0200
commita5f760fa0ed3e6e8a04675d7cfa97cdb75791efd (patch)
tree3324870cc33516acc28a74fcb2dfc663aec0b820
parent53541ee1bd0f6490ad62a1a8d7de3d154558a7ea (diff)
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.
-rw-r--r--sent.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sent.c b/sent.c
index 0da2bff..c50a572 100644
--- a/sent.c
+++ b/sent.c
@@ -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();