summaryrefslogtreecommitdiffstats
path: root/grapher
diff options
context:
space:
mode:
authorTim Moore <timoore@redhat.com>2009-12-03 23:45:51 +0100
committerTim Moore <timoore@redhat.com>2009-12-03 23:48:18 +0100
commit457a91c061a1658648fc155504795bf6f4c44740 (patch)
tree418e8d3d1344c2a7c0a473a78ff1c54a2302765a /grapher
parent03ebf81c360e429ef1e4f8bae48fe524f712589a (diff)
downloadsystemtap-steved-457a91c061a1658648fc155504795bf6f4c44740.tar.gz
systemtap-steved-457a91c061a1658648fc155504795bf6f4c44740.tar.xz
systemtap-steved-457a91c061a1658648fc155504795bf6f4c44740.zip
Error check in hover text code for empty graphs
* grapher/GraphStyle.cxx(GraphStyleEvent::dataIndexAtPoint, GraphStyleBar::dataIndexAtPoint): check for empty graph data
Diffstat (limited to 'grapher')
-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;