add sanity checks in save_file.c
though it would be a better idea to solve the problem that leads to -1 being passed to these instead
This commit is contained in:
parent
796e884f04
commit
7b8a7e4047
|
@ -342,6 +342,9 @@ static void save_file_bswap(struct SaveBuffer *buf) {
|
|||
}
|
||||
|
||||
void save_file_do_save(s32 fileIndex) {
|
||||
if (fileIndex < 0 || fileIndex >= NUM_SAVE_FILES)
|
||||
return;
|
||||
|
||||
if (gSaveFileModified)
|
||||
#ifdef TEXTSAVES
|
||||
{
|
||||
|
@ -370,6 +373,9 @@ void save_file_do_save(s32 fileIndex) {
|
|||
}
|
||||
|
||||
void save_file_erase(s32 fileIndex) {
|
||||
if (fileIndex < 0 || fileIndex >= NUM_SAVE_FILES)
|
||||
return;
|
||||
|
||||
touch_high_score_ages(fileIndex);
|
||||
bzero(&gSaveBuffer.files[fileIndex][0], sizeof(gSaveBuffer.files[fileIndex][0]));
|
||||
|
||||
|
@ -379,7 +385,8 @@ void save_file_erase(s32 fileIndex) {
|
|||
|
||||
//! Needs to be s32 to match on -O2, despite no return value.
|
||||
BAD_RETURN(s32) save_file_copy(s32 srcFileIndex, s32 destFileIndex) {
|
||||
UNUSED s32 pad;
|
||||
if (srcFileIndex < 0 || srcFileIndex >= NUM_SAVE_FILES || destFileIndex < 0 || destFileIndex >= NUM_SAVE_FILES)
|
||||
return;
|
||||
|
||||
touch_high_score_ages(destFileIndex);
|
||||
bcopy(&gSaveBuffer.files[srcFileIndex][0], &gSaveBuffer.files[destFileIndex][0],
|
||||
|
|
Loading…
Reference in New Issue