mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
82b86fe924
commit
022e2d0d9d
1 changed files with 5 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue