perl.cvs.parrot
[Top] [All Lists]

[svn:parrot] r20157 - trunk/src/ops

Subject: [svn:parrot] r20157 - trunk/src/ops
From:
Date: Tue, 24 Jul 2007 09:30:27 -0700 PDT
Newsgroups: perl.cvs.parrot

Author: petdance
Date: Tue Jul 24 09:30:26 2007
New Revision: 20157

Modified:
   trunk/src/ops/string.ops

Log:
Chekc for nullness of strings before calling string_str_index

Modified: trunk/src/ops/string.ops
==============================================================================
--- trunk/src/ops/string.ops    (original)
+++ trunk/src/ops/string.ops    Tue Jul 24 09:30:26 2007
@@ -306,12 +306,12 @@
 =cut
 
 inline op index(out INT, in STR, in STR) :base_core {
-    $1 = string_str_index(interp, $2, $3, 0);
+    $1 = $2 && $3 ? string_str_index(interp, $2, $3, 0) : -1;
     goto NEXT();
 }
 
 inline op index(out INT, in STR, in STR, in INT) :base_core {
-    $1 = string_str_index(interp, $2, $3, $4);
+    $1 = $2 && $3 ? string_str_index(interp, $2, $3, $4) : -1;
     goto NEXT();
 }
 

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:parrot] r20157 - trunk/src/ops, petdance <=