From e510498051c7496f2f34214ae983eb3abafc8fc1 Mon Sep 17 00:00:00 2001 From: Mat Date: Thu, 3 Mar 2016 13:30:14 +0000 Subject: [PATCH] Fix crash when system isn't already known to EDSM EDSM api is now returning "[]" instead of "-1" when the system name doesn't exist in its database. Fixes "Can't connect to EDSM" errors when jumping to a new system. --- edsm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/edsm.py b/edsm.py index 4e0ddb3c..72dbf761 100644 --- a/edsm.py +++ b/edsm.py @@ -47,7 +47,7 @@ class EDSM: r.raise_for_status() data = r.json() - if data == -1: + if data == -1 or (isinstance(data, list) and len(data) == 0): # System not present - but don't create it on the assumption that the caller will self.result['img'] = EDSM._IMG_NEW self.result['uncharted'] = True @@ -82,7 +82,7 @@ class EDSM: r.raise_for_status() data = r.json() - if data == -1: + if data == -1 or (isinstance(data, list) and len(data) == 0): # System not present - create it result['img'] = EDSM._IMG_NEW result['uncharted'] = True