glejeune / Ruby-Graphviz

[MIRROR] Ruby interface to the GraphViz graphing tool
https://gitlab.com/glejeune/ruby-graphviz
Other
608 stars 116 forks source link

dot execution status incorrectly processed #133

Open alxx opened 6 years ago

alxx commented 6 years ago

There's a problem in output_from_command (lib/graphviz/utils.rb) in the condition:

if (status.nil? && (errors.nil? || errors.strip.empty?)) || status.zero?

The method zero? crashes when status is nil, a situation which escapes the first half of the condition.

One correct way to write it would be:

if (status.nil? && (errors.nil? || errors.strip.empty?)) || 0 == status

I know I should do this as a pull request, but for just a few characters it doesn't seem worth it. Maybe someone in the team can do it?

Thanks!