SAGA2: Fix save game dialog crash

This commit is contained in:
a/ 2021-06-12 20:41:49 +09:00 committed by Eugene Sandulenko
parent b9e04f912e
commit 067fcb00d7
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
3 changed files with 8 additions and 6 deletions

View File

@ -181,7 +181,7 @@ gTextBox::gTextBox(
flags = flg;
currentLen[index] = buffer ? strlen(buffer) : 0;
cursorPos = anchorPos = scrollPixels = 0;
undoBuffer = (char *)malloc(sizeof(char) * (maxLen + 1));
undoBuffer = new char[maxLen + 1]();
textFont = font;
fontHeight = height;
fontOffset = fontHeight + 2;
@ -233,7 +233,7 @@ gTextBox::~gTextBox() {
deSelect();
selected = 0;
if (undoBuffer) {
delete undoBuffer;
delete[] undoBuffer;
}
}

View File

@ -593,11 +593,12 @@ void destroyFileFields(char **strings) {
uint16 i;
for (i = 0; i < numEditLines; i++) {
if (strings[i]) delete strings[i];
strings[i] = NULL;
if (strings[i])
delete[] strings[i];
strings[i] = nullptr;
}
delete strings;
delete[] strings;
}
bool getSaveName(int8 saveNo, SaveFileHeader &header) {

View File

@ -66,7 +66,8 @@ void gDisplayPort::bltPixels(
sect;
uint8 *src_line;
clip = Rect16(0, 0, map->size.x, map->size.y);
if (clip.empty())
clip = Rect16(0, 0, map->size.x, map->size.y);
sect = intersect(clip, r);
if (!sect.empty()) { // if result is non-empty