Add nil check for colors, just in case

Probably not possible, but provides a more descriptive error than before anyway.

Fixes #84.
This commit is contained in:
Andy Meneely
2015-07-21 21:37:54 -04:00
parent f21e9448e1
commit 70a5f48bda
2 changed files with 25 additions and 15 deletions
+2 -1
View File
@@ -30,6 +30,7 @@ module Squib
# :nodoc:
# @api private
def set_source_squibcolor(arg)
raise 'nil is not a valid color' if arg.nil?
if match = arg.match(LINEAR_GRADIENT)
x1, y1, x2, y2 = match.captures
linear = Cairo::LinearPattern.new(x1.to_f, y1.to_f, x2.to_f, y2.to_f)
@@ -82,4 +83,4 @@ module Squib
end
end
end
end