Bangle.js stop 'toast' warning message appearing when starting the app loader. Fix https://github.com/espruino/BangleApps/issues/2496

This commit is contained in:
Gordon Williams 2023-01-13 14:28:38 +00:00
parent cf0f2f3b97
commit b16464b3b6
1 changed files with 5 additions and 2 deletions

View File

@ -441,8 +441,11 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
// JSON - we hope!
try {
JSONObject json = new JSONObject(line);
LOG.info("UART RX JSON parsed successfully");
handleUartRxJSON(json);
if (json.has("t")) {
handleUartRxJSON(json);
LOG.info("UART RX JSON parsed successfully");
} else
LOG.warn("UART RX JSON parsed but doesn't contain 't' - ignoring");
} catch (JSONException e) {
LOG.info("UART RX JSON parse failure: "+ e.getLocalizedMessage());
GB.toast(getContext(), "Malformed JSON from Bangle.js: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);