[tor-commits] [flashproxy/master] Handle the case where userAgent is null or undefined.

dcf at torproject.org dcf at torproject.org
Sun Sep 4 21:57:15 UTC 2011


commit 60e3d0d790beb03b8d93cb15cfb9cca061d95d65
Author: David Fifield <david at bamsoftware.com>
Date:   Sun Sep 4 14:50:58 2011 -0700

    Handle the case where userAgent is null or undefined.
---
 swfcat.as |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/swfcat.as b/swfcat.as
index 26bf1da..85a1a1b 100644
--- a/swfcat.as
+++ b/swfcat.as
@@ -159,13 +159,14 @@ package
             var ua:String;
 
             ua = ExternalInterface.call("window.navigator.userAgent.toString");
-
-            for (var i:uint = 0; i < UA_LIST.length; i++) {
-                var re:RegExp = UA_LIST[i];
-
-                if (ua.match(re)) {
-                    puts("Disabling because User-Agent matched " + re + ".");
-                    return true;
+            if (ua != null) {
+                for (var i:uint = 0; i < UA_LIST.length; i++) {
+                    var re:RegExp = UA_LIST[i];
+
+                    if (ua.match(re)) {
+                        puts("Disabling because User-Agent matched " + re + ".");
+                        return true;
+                    }
                 }
             }
 





More information about the tor-commits mailing list