[FIX] AttributeError if station without link
[pywienerlinien] / iTip.py
diff --git a/iTip.py b/iTip.py
index 3e327c1..4b63f61 100644 (file)
--- a/iTip.py
+++ b/iTip.py
@@ -65,6 +65,10 @@ class iParser:
         
         #TODO parse line name and direction for station site parsing
         
+        if not url:
+            # FIXME prevent from calling this method with None
+            return []
+
         bs = BeautifulSoup(urlopen(url))
         result_lines = bs.findAll('table')[-1].findAll('tr')
         
@@ -115,7 +119,10 @@ if __name__ == '__main__':
         l = args.l.upper()
     else:
         l = None
-    s = args.s.decode('UTF-8')
+    if args.s:
+        s = args.s.decode('UTF-8')
+    else:
+        s = ''
     
     if l and l in lines:
         stations = itip.get_stations(l)