aboutsummaryrefslogtreecommitdiff
path: root/src/partialator.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-03-28 18:47:13 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:22 +0100
commit176b63b62ec8e9ee1cc782d25399f3abf25c85f2 (patch)
tree5f7616652715a3f33dd926934d432d5b8c219d96 /src/partialator.c
parent2a6ce4a23bd88ca2603b47559ac831dbead6c6ad (diff)
Fix up stream error handling
Diffstat (limited to 'src/partialator.c')
-rw-r--r--src/partialator.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/partialator.c b/src/partialator.c
index 0e2cfb2e..ea3eb50c 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -262,6 +262,10 @@ int main(int argc, char *argv[])
}
n_total_patterns = count_patterns(fh);
+ if ( n_total_patterns == 0 ) {
+ ERROR("No patterns to process.\n");
+ return 1;
+ }
STATUS("There are %i patterns to process\n", n_total_patterns);
images = malloc(n_total_patterns * sizeof(struct image));
@@ -280,7 +284,9 @@ int main(int argc, char *argv[])
Reflection *refl;
RefListIterator *iter;
- if ( read_chunk(fh, &images[i]) == 1 ) {
+ if ( read_chunk(fh, &images[i]) != 0 ) {
+ /* Should not happen, because we counted the patterns
+ * earlier. */
ERROR("Failed to read chunk from the input stream.\n");
return 1;
}