Skip to content

Fix crash on empty PlotList

Thomas Stibor requested to merge tstibor/kstars:fix_crash_altvstime into master

When PlotList is empty avtUI->PlotList->currentRow() returns -1 and pList.at(-1) hits the assertion:

ASSERT failure in QList::at: "index out of range", file /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h, line 571

__pthread_kill_implementation (threadid=, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 0x00007ffff43cad9f in __pthread_kill_internal (signo=6, threadid=) at ./nptl/pthread_kill.c:78 0x00007ffff437bf32 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 0x00007ffff4366472 in __GI_abort () at ./stdlib/abort.c:79 0x00007ffff4a90c79 in () at /lib/x86_64-linux-gnu/libQt5Core.so.5 0x00007ffff4a9007e in () at /lib/x86_64-linux-gnu/libQt5Core.so.5 0x00005555558b4703 in QList<SkyObject*>::at(int) const (this=0x7fff70014cb0, i=-1) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:571 0x00005555562cce95 in AltVsTime::slotComputeAltitudeByTime() (this=0x7fff70014c70) at /home/tstibor/astronomy/kstars/kstars/kstars/tools/altvstime.cpp:670

Merge request reports