[PATCH 13/13] Fix potential null pointer dereference

Anton Lundin glance at acc.umu.se
Tue Dec 10 15:53:37 UTC 2013


If createTemporaryPlan was called on a empty diveplan.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 qt-ui/diveplanner.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index dedbd61..fe7a7d1 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -1422,6 +1422,8 @@ void DivePlannerPointsModel::createTemporaryPlan()
 		lastIndex = i;
 		plan_add_segment(&diveplan, deltaT, p.depth, p.o2, p.he, p.po2);
 	}
+	if (!diveplan.dp)
+		return;
 	char *cache = NULL;
 	tempDive = NULL;
 	const char *errorString = NULL;
-- 
1.8.3.2



More information about the subsurface mailing list