X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fstate.c;h=f9a7f839f63177aedd80bde33df692746b92d1dc;hb=d9653efdf7cd77d61ed81ed692b00115d472d4e2;hp=a3695970d8d540934022016987a98880948bf162;hpb=ae214f1c37e5b02b6413040649a40f8ba3874e1b;p=picodrive.git diff --git a/pico/state.c b/pico/state.c index a369597..f9a7f83 100644 --- a/pico/state.c +++ b/pico/state.c @@ -180,7 +180,7 @@ typedef enum { CHUNK_CARTHW_ = CHUNK_CARTHW, // 64 (defined in PicoInt) } chunk_name_e; -static const char * const chunk_names[] = { +static const char * const chunk_names[CHUNK_DEFAULT_COUNT] = { "INVALID!", "M68K state", "RAM", @@ -237,7 +237,7 @@ static int write_chunk(chunk_name_e name, int len, void *data, void *file) } #define CHECKED_WRITE(name,len,data) { \ - if (PicoStateProgressCB && name < CHUNK_DEFAULT_COUNT) { \ + if (PicoStateProgressCB && name < CHUNK_DEFAULT_COUNT && chunk_names[name]) { \ strncpy(sbuff + 9, chunk_names[name], sizeof(sbuff) - 9); \ PicoStateProgressCB(sbuff); \ } \ @@ -245,7 +245,7 @@ static int write_chunk(chunk_name_e name, int len, void *data, void *file) } #define CHECKED_WRITE_BUFF(name,buff) { \ - if (PicoStateProgressCB && name < CHUNK_DEFAULT_COUNT) { \ + if (PicoStateProgressCB && name < CHUNK_DEFAULT_COUNT && chunk_names[name]) { \ strncpy(sbuff + 9, chunk_names[name], sizeof(sbuff) - 9); \ PicoStateProgressCB(sbuff); \ } \