[PATCH 2/2] Maintab: prevent a segfault in the 'Equipment' tab

Dirk Hohndel dirk at hohndel.org
Fri Jan 3 13:14:03 UTC 2014


On Fri, 2014-01-03 at 23:11 +0200, Lubomir I. Ivanov wrote:
> On 3 January 2014 14:49, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
> > From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
> >
> > When a dive contains no cylinders, clicking the '+'
> > button could SIGSEGV if current_dive->dc.model is NULL.
> >
> > Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
> > ---
> >
> >     newEditMode=MainTab::NONE) at qt-ui/maintab.cpp:225
> >     at qt-ui/maintab.cpp:546
> > ...
> > ---
> >  qt-ui/maintab.cpp | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
> > index 4fc543f..8da1137 100644
> > --- a/qt-ui/maintab.cpp
> > +++ b/qt-ui/maintab.cpp
> > @@ -223,6 +223,7 @@ void MainTab::enableEdition(EditMode newEditMode)
> >         if (current_dive == NULL || editMode != NONE)
> >                 return;
> >         if ((newEditMode == DIVE || newEditMode == NONE) &&
> > +           current_dive->dc.model &&
> >             strcmp(current_dive->dc.model, "manually added dive") == 0) {
> >                 // editCurrentDive will call enableEdition with newEditMode == MANUALLY_ADDED_DIVE
> >                 // so exit this function here after editCurrentDive() returns
> > --
> > 1.7.11.msysgit.0
> >
> 
> 
> this one is a real bug btw.
> i think it happens with some auto-generated dives that i had for the
> print testing.
> it reaches a NULL current_dive->dc.model.

Agreed. I applied the post 4.0.1 patches and pushed them out a minute
ago

/D




More information about the subsurface mailing list