src/state.c

changeset 138
d744db15cdf7
parent 112
a392eb8f9806
     1.1 diff -r 994d03cdcba2 -r d744db15cdf7 src/state.c
     1.2 --- a/src/state.c	Thu Apr 11 09:36:53 2013 +0100
     1.3 +++ b/src/state.c	Thu Apr 11 09:37:11 2013 +0100
     1.4 @@ -76,8 +76,14 @@
     1.5  	uint8_t *romdat1, *romdat2;
     1.6  	romdat1 = malloc(romlen);
     1.7  	romdat2 = malloc(romlen2);
     1.8 -	fread(romdat1, 1, romlen, r15c);
     1.9 -	fread(romdat2, 1, romlen2, r14c);
    1.10 +	if (fread(romdat1, 1, romlen, r15c) != romlen) {
    1.11 +		fprintf(stderr, "[state] Error reading ROM 15C.\n");
    1.12 +		return -3;
    1.13 +	}
    1.14 +	if (fread(romdat2, 1, romlen2, r14c) != romlen) {
    1.15 +		fprintf(stderr, "[state] Error reading ROM 14C.\n");
    1.16 +		return -3;
    1.17 +	}
    1.18  
    1.19  	// convert the ROM data
    1.20  	for (size_t i=0; i<(romlen + romlen2); i+=2) {