]> code.delx.au - monosys/commitdiff
opal-card-tool: Don't crash when there's nothing to plot
authorJames Bunton <jamesbunton@delx.net.au>
Sun, 8 Mar 2015 03:30:00 +0000 (14:30 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Sun, 8 Mar 2015 03:30:00 +0000 (14:30 +1100)
scripts/opal-card-tool

index 9e759adcadd51c758b664422e195c632c10c8422..025fbbec61eebf81287c59c5cc1c727070812e4c 100755 (executable)
@@ -189,9 +189,15 @@ class CommuterGraph(object):
         self.xrange_start = None
         self.xrange_end = None
 
+    def is_plottable(self):
+        return self.xrange_start is not None and self.xrange_end is not None
+
     def graph(self, transaction_list):
         try:
             self.write_points(transaction_list)
+            if not self.is_plottable():
+                print("No transactions!", file=sys.stderr)
+                return
             self.write_plot_command()
             self.flush_files()
             self.run_gnuplot()