mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
undo: exit early if no event in RemoveEvent()
To avoid dereferencing a null pointer. Found by Coverity. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d295ca1d17
commit
01705a6449
1 changed files with 3 additions and 1 deletions
|
@ -120,8 +120,10 @@ RemoveEvent::RemoveEvent(struct dive *d, int dcNr, int idxIn) : EventBase(d, dcN
|
|||
{
|
||||
struct divecomputer *dc = d->get_dc(dcNr);
|
||||
event *ev = get_event(dc, idx);
|
||||
if (!ev)
|
||||
if (!ev) {
|
||||
idx = -1;
|
||||
return;
|
||||
}
|
||||
if (ev->type == SAMPLE_EVENT_GASCHANGE2 || ev->type == SAMPLE_EVENT_GASCHANGE)
|
||||
cylinder = ev->gas.index;
|
||||
setText(Command::Base::tr("Remove %1 event").arg(ev->name.c_str()));
|
||||
|
|
Loading…
Add table
Reference in a new issue