diff options
author | Anton Lundin <glance@acc.umu.se> | 2013-12-11 00:53:35 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-12-11 03:13:30 +0100 |
commit | 022e2d0d9d83ae804cf9a1ccfbbe4f5b36fac67c (patch) | |
tree | dbf6f2ab9bfb9e0301642aa3244921d3be982424 | |
parent | 82b86fe924ed11969a7653641fdbd32ac27dc538 (diff) | |
download | subsurface-022e2d0d9d83ae804cf9a1ccfbbe4f5b36fac67c.tar.gz |
Guard against dereferencing undef
Introduce some harness in ProfileGraphicsView::plot_one_event, so we
detect bad stuff and bail, instead of dereferencing undef pointers.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/profilegraphics.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index f99fd4d2e..18e97da78 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -956,7 +956,7 @@ void ProfileGraphicsView::plot_one_event(struct event *ev) { int i; struct plot_info *pi = &gc.pi; - struct plot_data *entry; + struct plot_data *entry = NULL; /* is plotting of this event disabled? */ if (ev->name) { @@ -981,6 +981,10 @@ void ProfileGraphicsView::plot_one_event(struct event *ev) break; } + /* If we didn't find the right event, don't dereference null */ + if (entry == NULL) + return; + /* draw a little triangular marker and attach tooltip */ int x = SCALEXGC(ev->time.seconds); |