diff options
author | Tim Moore <timoore@redhat.com> | 2009-12-03 23:45:51 +0100 |
---|---|---|
committer | Tim Moore <timoore@redhat.com> | 2009-12-03 23:48:18 +0100 |
commit | 457a91c061a1658648fc155504795bf6f4c44740 (patch) | |
tree | 418e8d3d1344c2a7c0a473a78ff1c54a2302765a | |
parent | 03ebf81c360e429ef1e4f8bae48fe524f712589a (diff) | |
download | systemtap-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
-rw-r--r-- | grapher/GraphStyle.cxx | 6 |
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; |