summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tmx.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tmx.c b/src/tmx.c
index 731f76c..4695a9e 100644
--- a/src/tmx.c
+++ b/src/tmx.c
@@ -119,9 +119,13 @@ tmx_start_image(struct tmx *cur_tmx, const char **attr)
err(1, "Malformed TMX file");
}
+ source = NULL;
foreach_tmx_attr (attr) {
tmx_get_string_attr(attr, "source", source);
}
+ if (source == NULL) {
+ err(1, "No \"source\" attribute found in \"image\" tag");
+ }
/* TODO: Move to end tag handler and check for "loadimage" property. */
path = malloc(strlen(cur_tmx->dirname) + strlen(source) + 2);
@@ -265,6 +269,10 @@ tmx_end_data(struct tmx *cur_tmx)
}
decompress(decoded_buf, decoded_len, decomp_buf, decomp_len);
free(decoded_buf);
+ } else {
+ /* This should never happen. This branch exists only to silence
+ * GCC's maybe-uninitialized warning on decomp_buf below. */
+ return;
}
free(cur_tmx->layer_data);