summaryrefslogtreecommitdiff
path: root/tools/pokemon_animation.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/pokemon_animation.c')
-rw-r--r--tools/pokemon_animation.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/pokemon_animation.c b/tools/pokemon_animation.c
index 835160c24..315a1729f 100644
--- a/tools/pokemon_animation.c
+++ b/tools/pokemon_animation.c
@@ -4,6 +4,7 @@
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
+#include <getopt.h>
struct Frame {
uint8_t* data;
@@ -53,9 +54,17 @@ void make_frames(struct Frames* frames, struct Bitmasks* bitmasks, char* tilemap
fseek(f, 0, SEEK_END);
size = ftell(f);
+ if (!size) {
+ fprintf(stderr, "empty file %s\n", tilemap_filename);
+ exit(1);
+ }
rewind(f);
tilemap = malloc(size);
+ if (!tilemap) {
+ fprintf(stderr, "malloc failure\n");
+ exit(1);
+ }
fread(tilemap, 1, size, f);
fclose(f);
@@ -228,7 +237,7 @@ int main(int argc, char* argv[]) {
struct Frames frames = {0};
struct Bitmasks bitmasks = {0};
int ch;
- bool use_bitmasks, use_frames;
+ bool use_bitmasks = false, use_frames = false;
char* tilemap_filename;
char* dimensions_filename;