]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Check for string before copying
authorMorgan Haskel <morgan@puppetlabs.com>
Thu, 19 Feb 2015 20:01:26 +0000 (12:01 -0800)
committerMorgan Haskel <morgan@puppetlabs.com>
Thu, 19 Feb 2015 20:01:26 +0000 (12:01 -0800)
lib/puppet/parser/functions/is_domain_name.rb

index 24cc2085fb832eb101554480d46d99f679d45f46..2860dede59fdf84ea056bad9de847a90dc423ea1 100644 (file)
@@ -13,6 +13,9 @@ Returns true if the string passed to this function is a syntactically correct do
         "given #{arguments.size} for 1")
     end
 
+    # Only allow string types
+    return false unless arguments[0].is_a?(String)
+
     domain = arguments[0].dup
 
     # Limits (rfc1035, 3.1)
@@ -20,9 +23,6 @@ Returns true if the string passed to this function is a syntactically correct do
     label_min_length=1
     label_max_length=63
 
-    # Only allow string types
-    return false unless domain.is_a?(String)
-
     # Allow ".", it is the top level domain
     return true if domain == '.'