Skip to content

Commit 68e4ce4

Browse files
authored
fix: crash loop on new chip (#45)
changes: skip reading bitmaps on invalid magic header
1 parent a8b32e9 commit 68e4ce4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/data.c

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ uint16_t data_flash2newmem(uint8_t **chunk, uint32_t n)
4343
{
4444
data_legacy_t *header = data_get_header(0);
4545

46+
if (memcmp(header->header, "wang", 5))
47+
return 0;
48+
4649
uint16_t size = bswap16(header->sizes[n]) * LED_ROWS;
4750
if (size == 0)
4851
return 0;

src/main.c

+3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ void play_splash(xbm_t *xbm, int col, int row)
7979

8080
void load_bmlist()
8181
{
82+
if (data_get_header(0) == 0) // There is no bitmap stored in flash
83+
return; // skip
84+
8285
bm_t *curr_bm = bmlist_current();
8386

8487
for (int i=0; i<8; i++) {

0 commit comments

Comments
 (0)