From 4fa8ace8f00dbf81a57f39b14da853fedb0127e3 Mon Sep 17 00:00:00 2001
From: Jonathan Harris <jonathan@marginal.org.uk>
Date: Mon, 15 May 2017 15:21:27 +0100
Subject: [PATCH] Workaround for inconsistent ships data

---
 stats.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stats.py b/stats.py
index 1bf23bb4..19f7e4d5 100644
--- a/stats.py
+++ b/stats.py
@@ -149,7 +149,7 @@ def ships(data):
     ships = companion.listify(data.get('ships'))
     current = data['commander'].get('currentShipId')
 
-    if isinstance(current, int) and ships[current]:
+    if isinstance(current, int) and current < len(ships) and ships[current]:
         ships.insert(0, ships.pop(current))	# Put current ship first
 
         if not data['commander'].get('docked'):