diff --git a/file_ops.c b/file_ops.c index 5bbc3a72dd..e477f3d044 100644 --- a/file_ops.c +++ b/file_ops.c @@ -121,6 +121,9 @@ static bool read_generic_file(const char *path, void **buf, ssize_t *len) if ((ret = fread(rom_buf, 1, _len, file)) < _len) RARCH_WARN("Didn't read whole file.\n"); + if (!rom_buf) + goto error; + *buf = rom_buf; /* Allow for easy reading of strings to be safe.