summaryrefslogtreecommitdiff
path: root/graph.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-10-09 20:51:43 +0100
committerNick White <git@njw.name>2019-10-09 20:51:43 +0100
commit7807cae93dadf4772828d465b0a367095e4dcd46 (patch)
tree5a39312781cd32ad272e4e792d33c48da9806f19 /graph.go
parent8908fc011f83aee2a958d798648d08a0d04fa55b (diff)
Make confgraph and graph in general more resilient to bad input
Diffstat (limited to 'graph.go')
-rw-r--r--graph.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/graph.go b/graph.go
index 955abbd..1604d06 100644
--- a/graph.go
+++ b/graph.go
@@ -1,6 +1,7 @@
package bookpipeline
import (
+ "errors"
"fmt"
"io"
"path/filepath"
@@ -61,6 +62,10 @@ func Graph(confs map[string]*Conf, bookname string, w io.Writer) error {
}
sort.Slice(graphconf, func(i, j int) bool { return graphconf[i].Pgnum < graphconf[j].Pgnum })
+ if len(graphconf) == 0 {
+ return errors.New("No valid confidences")
+ }
+
// Create main xvalues and yvalues, annotations and ticks
var xvalues, yvalues []float64
var annotations []chart.Value2