diff options
Diffstat (limited to 'fshare.py')
-rwxr-xr-x | fshare.py | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -179,7 +179,13 @@ class URLMap: data = [l.strip().split() for l in self._file.readlines()] self._short_to_full = dict(data) self._full_to_short = dict(((b, a) for (a, b) in data)) - self._next_id = self._enc.decode_url(data[-1][0]) if len(data) else 0 + + try: + self._next_id = self._enc.decode_url(data[-1][0]) + except (IndexError, ValueError): + # data is empty or the mapping uses characters not in alphabet + self._next_id = 0 + except: self.close() raise |