Fix crash

This commit is contained in:
sanni 2022-08-03 19:48:12 +02:00
parent b5bff8c1f0
commit 5012ca88ac
2 changed files with 12 additions and 4 deletions

View File

@ -460,7 +460,10 @@ void setCart_COL() {
else if (b == 2) { else if (b == 2) {
for (byte count_newline = 0; count_newline < 7; count_newline++) { for (byte count_newline = 0; count_newline < 7; count_newline++) {
while (1) { while (1) {
if (myFile.peek() == '\n') { if (myFile.curPosition() == 0) {
break;
}
else if (myFile.peek() == '\n') {
myFile.seekSet(myFile.curPosition() - 1); myFile.seekSet(myFile.curPosition() - 1);
break; break;
} }
@ -469,7 +472,8 @@ void setCart_COL() {
} }
} }
} }
myFile.seekSet(myFile.curPosition() + 2); if (myFile.curPosition() != 0)
myFile.seekSet(myFile.curPosition() + 2);
break; break;
} }

View File

@ -859,7 +859,10 @@ void setCart_INTV() {
else if (b == 2) { else if (b == 2) {
for (byte count_newline = 0; count_newline < 7; count_newline++) { for (byte count_newline = 0; count_newline < 7; count_newline++) {
while (1) { while (1) {
if (myFile.peek() == '\n') { if (myFile.curPosition() == 0) {
break;
}
else if (myFile.peek() == '\n') {
myFile.seekSet(myFile.curPosition() - 1); myFile.seekSet(myFile.curPosition() - 1);
break; break;
} }
@ -868,7 +871,8 @@ void setCart_INTV() {
} }
} }
} }
myFile.seekSet(myFile.curPosition() + 2); if (myFile.curPosition() != 0)
myFile.seekSet(myFile.curPosition() + 2);
break; break;
} }