Do not search for pseudo country if text only contains one line.
authorStéphane Jacob <sj@m4x.org>
Sun, 26 Dec 2010 20:48:02 +0000 (21:48 +0100)
committerStéphane Jacob <sj@m4x.org>
Tue, 28 Dec 2010 10:53:20 +0000 (11:53 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/gmapsgeocoder.php

index d8fad1f..f6a3dc1 100644 (file)
@@ -334,10 +334,12 @@ class GMapsGeocoder extends Geocoder {
         $countLines = count($textLines);
         $needle     = strtoupper(trim($textLines[$countLines - 2]));
         $isPseudoCountry = false;
-        foreach ($countries as $country) {
-            if (strtoupper($country) == $needle) {
-                $isPseudoCountry = true;
-                break;
+        if ($needle) {
+            foreach ($countries as $country) {
+                if (strtoupper($country) === $needle) {
+                    $isPseudoCountry = true;
+                    break;
+                }
             }
         }