Fix: Avoid a 0 size malloc when there are no entry to copy in current selection
This commit is contained in:
parent
ccf278d144
commit
ec2528db54
@ -577,21 +577,24 @@ static void copySelection(int row, int track, int selectLeft, int selectRight, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(s_copyData.entries);
|
free(s_copyData.entries);
|
||||||
entry = s_copyData.entries = malloc(sizeof(CopyEntry) * copy_count);
|
if (copy_count != 0)
|
||||||
|
|
||||||
for (track = selectLeft; track <= selectRight; ++track)
|
|
||||||
{
|
{
|
||||||
struct sync_track* t = tracks[track];
|
entry = s_copyData.entries = malloc(sizeof(CopyEntry) * copy_count);
|
||||||
for (row = selectTop; row <= selectBottom; ++row)
|
|
||||||
{
|
|
||||||
int idx = sync_find_key(t, row);
|
|
||||||
if (idx < 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
entry->track = track - selectLeft;
|
for (track = selectLeft; track <= selectRight; ++track)
|
||||||
entry->keyFrame = t->keys[idx];
|
{
|
||||||
entry->keyFrame.row -= selectTop;
|
struct sync_track* t = tracks[track];
|
||||||
entry++;
|
for (row = selectTop; row <= selectBottom; ++row)
|
||||||
|
{
|
||||||
|
int idx = sync_find_key(t, row);
|
||||||
|
if (idx < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
entry->track = track - selectLeft;
|
||||||
|
entry->keyFrame = t->keys[idx];
|
||||||
|
entry->keyFrame.row -= selectTop;
|
||||||
|
entry++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user