From c1e67b716c7f1d49eb59ecb76252a8a013159717 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Thu, 22 Oct 2020 12:07:30 +1100 Subject: [PATCH] Added exception handling to ML grid detection --- src/helpers/map.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/helpers/map.js b/src/helpers/map.js index a6875ba..cb70300 100644 --- a/src/helpers/map.js +++ b/src/helpers/map.js @@ -133,7 +133,16 @@ async function gridSizeML(image, candidates) { export async function getGridSize(image) { const candidates = dividers(image.width, image.height); - let prediction = await gridSizeML(image, candidates); + let prediction; + + // Try and use ML grid detection + // TODO: Fix possible error on Android + try { + prediction = await gridSizeML(image, candidates); + } catch (error) { + console.error(error); + } + if (!prediction) { prediction = gridSizeHeuristic(image, candidates); }