[PATCH] Don't crash if we try to save a empty plan

Anton Lundin glance at acc.umu.se
Sat Mar 22 14:48:46 PDT 2014


On 22 March, 2014 - Lakshman wrote:

> On Sat, Mar 22, 2014 at 9:13 AM, Anton Lundin <glance at acc.umu.se> wrote:
> > Just treat it as a cancel instead.
> >
> > Signed-off-by: Anton Lundin <glance at acc.umu.se>
> > ---
> >  qt-ui/diveplanner.cpp | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
> > index da5bb53..ac2662c 100644
> > --- a/qt-ui/diveplanner.cpp
> > +++ b/qt-ui/diveplanner.cpp
> > @@ -1468,6 +1468,9 @@ void DivePlannerPointsModel::createPlan()
> >         char *cache = NULL;
> >         tempDive = NULL;
> >
> > +       if (!diveplan.dp)
> > +               return cancelPlan();
> > +
> >         createTemporaryPlan();
> >         plan(&diveplan, &cache, &tempDive, isPlanner());
> >         copy_cylinders(stagingDive, tempDive);
> > --
> Instead of cancelling the plan, which sets the Mode to NOTHING, i.e.
> user has to click on "New Plan" again, wouldn't it be better and
> useful to add the following "if" statement, instead of the above one
>      if (!rowCount()) return;
> This way, Mode is not changed, and user can still be in PLAN mode,
> i.e. same window.
> 

Tried that and it felt just weird. Hit save and nothing happens. If you
would like to save a empty plan you get nothing saved, felt like a more
sane idea.

//Anton

-- 
Anton Lundin	+46702-161604


More information about the subsurface mailing list