From 203e9c7b4622ec32979a0cf74b8615106bd28219 Mon Sep 17 00:00:00 2001 From: Cmdr McDonald Date: Wed, 14 Dec 2016 08:49:23 +0000 Subject: [PATCH] Fix for importing definitions with missing slots --- src/app/utils/CompanionApiUtils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/utils/CompanionApiUtils.js b/src/app/utils/CompanionApiUtils.js index 46d7fc05..d0da068a 100644 --- a/src/app/utils/CompanionApiUtils.js +++ b/src/app/utils/CompanionApiUtils.js @@ -224,7 +224,9 @@ export function shipFromJson(json) { // Now that we know what we're looking for, find it const hardpointName = HARDPOINT_NUM_TO_CLASS[hardpointClassNum] + 'Hardpoint' + hardpointSlotNum; const hardpointSlot = json.modules[hardpointName]; - if (!hardpointSlot.module) { + if (!hardpointSlot) { + // This can happen with old imports that don't contain new hardpoints + } else if (!hardpointSlot.module) { // No module } else { const hardpointJson = hardpointSlot.module; @@ -251,7 +253,9 @@ export function shipFromJson(json) { } internalSlotNum++; } - if (!internalSlot.module) { + if (!internalSlot) { + // This can happen with old imports that don't contain new slots + } else if (!internalSlot.module) { // No module } else { const internalJson = internalSlot.module;