busachick / harviewer

Automatically exported from code.google.com/p/harviewer
0 stars 0 forks source link

[Patch] Fix undefined error when no text is passed in #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This code causes an error when it's used to split the lines of a response
and there isn't one (ie. a 301 redirect).

--- har.lib.js  2010-05-05 16:46:03.000000000 -0700
+++ har.lib.js.orig 2010-05-02 22:42:26.000000000 -0700
@@ -353,10 +353,7 @@
     splitLines: function(text)
     {
         var reSplitLines = /\r\n|\r|\n/;
-        if (!text) {
-            return [];
-        }
-        else if (text.split)
+        if (text.split)
             return text.split(reSplitLines);
         else
         {

Original issue reported on code.google.com by adrian...@gmail.com on 6 May 2010 at 12:09

GoogleCodeExporter commented 8 years ago
Oops, patch was the wrong way around.  Let's try that again:

--- har.lib.js.orig 2010-05-02 22:42:26.000000000 -0700
+++ har.lib.js  2010-05-05 16:46:03.000000000 -0700
@@ -353,7 +353,10 @@
     splitLines: function(text)
     {
         var reSplitLines = /\r\n|\r|\n/;
-        if (text.split)
+        if (!text) {
+            return [];
+        }
+        else if (text.split)
             return text.split(reSplitLines);
         else
         {

Original comment by adrian...@gmail.com on 6 May 2010 at 12:59

GoogleCodeExporter commented 8 years ago
Patch committed at R99
Will be in HARViewer 1.1-9

Please verify

Thanks for the report + patch!
Honza

Original comment by odva...@gmail.com on 6 May 2010 at 5:34

GoogleCodeExporter commented 8 years ago
This bug should be fixed in HAR 1.1-9, R188
Please verify.

Thanks for the report!
Honza

Original comment by odva...@gmail.com on 6 Jun 2010 at 7:10

GoogleCodeExporter commented 8 years ago
Sorry, the revision is: R118
Honza

Original comment by odva...@gmail.com on 6 Jun 2010 at 7:11