From: mental Date: Sat, 12 Aug 2006 07:10:46 +0000 (+0000) Subject: invariants are usually clearer up front X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e8febbe183f42d9e406bdf0c92b8cd8ef6352542;p=inkscape.git invariants are usually clearer up front --- diff --git a/share/extensions/simplepath.rb b/share/extensions/simplepath.rb index 7c634fe24..466a75d10 100755 --- a/share/extensions/simplepath.rb +++ b/share/extensions/simplepath.rb @@ -78,7 +78,9 @@ def parsePath(d) lastCommand = nil lexPath(d) do |token, isCommand| - unless command + if command + raise 'Invalid number of parameters' if isCommand + else if isCommand raise 'Invalid path, must begin with moveto.' \ unless lastCommand or token.upcase == 'M' @@ -94,8 +96,6 @@ def parsePath(d) end end outputCommand = command.upcase - else - raise 'Invalid number of parameters' if isCommand end unless isCommand