Don't draw tooltips if no profile is displayed

This fixes ticket 33

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-12-10 11:02:33 -08:00
parent 7cf1960336
commit 0ae16899de
2 changed files with 7 additions and 2 deletions

View file

@ -1302,6 +1302,10 @@ static gboolean profile_tooltip (GtkWidget *widget, gint x, gint y,
if (tx < 0 || ty < 0)
return FALSE;
/* don't draw a tooltip if nothing is there */
if (gc->pi.nr == 0)
return FALSE;
width = drawing_area->width - 2*drawing_area->x;
height = drawing_area->height - 2*drawing_area->y;
if (width <= 0 || height <= 0)

View file

@ -2120,7 +2120,7 @@ void get_plot_details(struct graphics_context *gc, int time, char *buf, size_t b
{
struct plot_info *pi = &gc->pi;
int pressure = 0, temp = 0;
struct plot_data *entry;
struct plot_data *entry = NULL;
int i;
for (i = 0; i < pi->nr; i++) {
@ -2132,5 +2132,6 @@ void get_plot_details(struct graphics_context *gc, int time, char *buf, size_t b
if (entry->sec >= time)
break;
}
plot_string(entry, buf, bufsize, entry->depth, pressure, temp, pi->has_ndl);
if (entry)
plot_string(entry, buf, bufsize, entry->depth, pressure, temp, pi->has_ndl);
}