fix crash if extra_rawfile(2, ...) is called when no initial raw file is loaded
This commit is contained in:
parent
c68866c994
commit
4985fb6e61
|
|
@ -830,9 +830,13 @@ int extra_rawfile(int what, const char *file, const char *type)
|
||||||
char f[PATH_MAX];
|
char f[PATH_MAX];
|
||||||
dbg(1, "extra_rawfile(): what=%d, file=%s, type=%s\n",
|
dbg(1, "extra_rawfile(): what=%d, file=%s, type=%s\n",
|
||||||
what, file ? file : "NULL", type ? type : "NULL");
|
what, file ? file : "NULL", type ? type : "NULL");
|
||||||
|
|
||||||
|
|
||||||
if(xctx->raw && xctx->extra_raw_n == 0) {
|
if(xctx->raw && xctx->extra_raw_n == 0) {
|
||||||
xctx->extra_raw_arr[xctx->extra_raw_n] = xctx->raw;
|
xctx->extra_raw_arr[xctx->extra_raw_n] = xctx->raw;
|
||||||
xctx->extra_raw_n++;
|
xctx->extra_raw_n++;
|
||||||
|
} else {
|
||||||
|
return 1; /* an initial raw file must be present before calling extra_rawfile() */
|
||||||
}
|
}
|
||||||
/* **************** read ************* */
|
/* **************** read ************* */
|
||||||
if(what == 1 && xctx->extra_raw_n < MAX_RAW_N && file && type) {
|
if(what == 1 && xctx->extra_raw_n < MAX_RAW_N && file && type) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue