summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--grapher/GraphStyle.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/grapher/GraphStyle.cxx b/grapher/GraphStyle.cxx
index cf3855e3..fdc8c4d6 100644
--- a/grapher/GraphStyle.cxx
+++ b/grapher/GraphStyle.cxx
@@ -50,7 +50,7 @@ namespace systemtap
{
shared_ptr<GraphData<double> > realData
= dynamic_pointer_cast<GraphData<double> >(graphData);
- if (!realData)
+ if (!realData || graphData->times.empty())
return -1;
int64_t left, right;
double top, bottom;
@@ -58,6 +58,8 @@ namespace systemtap
double t = graph->getTimeAtPoint(x);
TimeListPair range
= equal_range(graphData->times.begin(), graphData->times.end(), t);
+ if (range.first == graphData->times.end())
+ return -1;
size_t dataIndex = distance(graphData->times.begin(), range.first);
double val = realData->data[dataIndex];
double ycoord = val * graph->_graphHeight / graphData->scale;
@@ -149,7 +151,7 @@ namespace systemtap
{
shared_ptr<GraphData<string> > stringData
= dynamic_pointer_cast<GraphData<string> >(graphData);
- if (!stringData)
+ if (!stringData || graphData->times.empty())
return -1;
int64_t left, right;
double top, bottom;