diff --git a/stdlib/strscan.rb b/stdlib/strscan.rb
index <HASH>..<HASH> 100644
--- a/stdlib/strscan.rb
+++ b/stdlib/strscan.rb
@@ -55,6 +55,10 @@ class StringScanner
         return nil;
       }
 
+      if (match[idx] == null) {
+        return nil;
+      }
+
       return match[idx];
     }
   end
Fix StringScanner#[] to return nil for missing match.

This was causing a bug running our stringscanner implmentation in
javascript as `undefined` was slipping into the lexer/parser from this
method.