Nasty error with valid JSON but incorrect linking matrix
When called with an empty linking matrix, cate
fails with an exception. This should be handled gracefully.
Steps to reproduce:
$ echo '[]' | cate -
This call then fails with the following trace:
Starting constructing the tree
Maximum possible level: 0
Finished constructing the tree
Starting generating the report
Finished generating the report
Starting creation of the SVG template
Traceback (most recent call last):
File "/home/bleuse/devel/cate-dev.venv36/bin/cate", line 11, in <module>
load_entry_point('cate', 'console_scripts', 'cate')()
File "/home/bleuse/src/cate.git/src/cate/cli.py", line 82, in cli
main.run(matrix, **options)
File "/home/bleuse/src/cate.git/src/cate/main.py", line 361, in run
drawSVGTemplate(matrix, myTree, output, entireTemplate=complete_flow, white=not color, scale=scale)
File "/home/bleuse/src/cate.git/src/cate/main.py", line 246, in drawSVGTemplate
maxTorsions = abs(max(torsions, key=abs))
ValueError: max() arg is an empty sequence
Edited by Raphaël Bleuse