diff options
author | Markus Holtermann <info@markusholtermann.eu> | 2013-01-26 00:04:54 +0100 |
---|---|---|
committer | Markus Holtermann <info@markusholtermann.eu> | 2013-01-26 00:04:54 +0100 |
commit | 97ec685d169289147cc4d46d89a376f283f119c7 (patch) | |
tree | 68bb4b5088ac7b6e281e74968c24a9855ce61c71 /bvggrabber | |
parent | 3e3bad7ac63819d6a4195eba53bf35f5dd9cffbe (diff) | |
download | bvg-grabber-97ec685d169289147cc4d46d89a376f283f119c7.tar.gz bvg-grabber-97ec685d169289147cc4d46d89a376f283f119c7.tar.bz2 bvg-grabber-97ec685d169289147cc4d46d89a376f283f119c7.zip |
Fix null pointer exception
Diffstat (limited to 'bvggrabber')
-rw-r--r-- | bvggrabber/api/actualdeparture.py | 5 | ||||
-rw-r--r-- | bvggrabber/api/scheduleddeparture.py | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/bvggrabber/api/actualdeparture.py b/bvggrabber/api/actualdeparture.py index 7cdac17..f6f5fe2 100644 --- a/bvggrabber/api/actualdeparture.py +++ b/bvggrabber/api/actualdeparture.py @@ -38,7 +38,10 @@ class ActualDepartureQueryApi(QueryApi): return (False, []) else: # The station seems to exist - rows = soup.find('tbody').find_all('tr') + tbody = soup.find('tbody') + if tbody is None: + return (False, []) + rows = tbody.find_all('tr') departures = [] for row in rows: tds = row.find_all('td') diff --git a/bvggrabber/api/scheduleddeparture.py b/bvggrabber/api/scheduleddeparture.py index cf374f6..38d8f8a 100644 --- a/bvggrabber/api/scheduleddeparture.py +++ b/bvggrabber/api/scheduleddeparture.py @@ -56,7 +56,10 @@ class ScheduledDepartureQueryApi(QueryApi): return (False, []) else: # The station seems to exist - rows = soup.find('tbody').find_all('tr') + tbody = soup.find('tbody') + if tbody is None: + return (False, []) + rows = tbody.find_all('tr') departures = [] for row in rows: tds = row.find_all('td') |