previous fix did not fix. Fix the fix

This commit is contained in:
stefan schippers 2023-10-26 19:38:25 +02:00
parent 4985fb6e61
commit 9f1b447c16
1 changed files with 2 additions and 4 deletions

View File

@ -835,8 +835,6 @@ int extra_rawfile(int what, const char *file, const char *type)
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) {
@ -872,7 +870,7 @@ int extra_rawfile(int what, const char *file, const char *type)
xctx->raw = xctx->extra_raw_arr[xctx->extra_idx]; xctx->raw = xctx->extra_raw_arr[xctx->extra_idx];
} }
/* **************** switch ************* */ /* **************** switch ************* */
} else if(what == 2) { } else if(what == 2 && xctx->extra_raw_n > 0) {
if(file && type) { if(file && type) {
tclvareval("subst {", file, "}", NULL); tclvareval("subst {", file, "}", NULL);
my_strncpy(f, tclresult(), S(f)); my_strncpy(f, tclresult(), S(f));
@ -897,7 +895,7 @@ int extra_rawfile(int what, const char *file, const char *type)
} }
xctx->raw = xctx->extra_raw_arr[xctx->extra_idx]; xctx->raw = xctx->extra_raw_arr[xctx->extra_idx];
/* **************** switch back ************* */ /* **************** switch back ************* */
} else if(what == 5) { } else if(what == 5 && xctx->extra_raw_n > 0) {
int tmp; int tmp;
dbg(1, "extra_rawfile() switch back: extra_idx=%d, extra_prev_idx=%d\n", dbg(1, "extra_rawfile() switch back: extra_idx=%d, extra_prev_idx=%d\n",
xctx->extra_idx, xctx->extra_prev_idx); xctx->extra_idx, xctx->extra_prev_idx);