planner: check nextdp for null

As correctly noted by Coverity, we check nextdp for null
and later dereference it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-08-13 22:50:11 +02:00 committed by Michael Keller
parent c91884223f
commit 2bbc95e8f1

View file

@ -219,7 +219,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
continue; continue;
/* Store pointer to last entered datapoint for minimum gas calculation */ /* Store pointer to last entered datapoint for minimum gas calculation */
if (dp->entered && !nextdp->entered) if (dp->entered && nextdp && !nextdp->entered)
lastbottomdp = dp; lastbottomdp = dp;
if (plan_verbatim) { if (plan_verbatim) {