From d904a58db0ca2736ba4c42637dc41b54c7b3a68c Mon Sep 17 00:00:00 2001 From: scrudden Date: Sat, 9 Jun 2018 21:30:15 +0100 Subject: [PATCH] Fix JSON exception in case where route_id not there. --- .../main/java/org/transitclock/custom/mbta/BusLocAvlModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transitclock/src/main/java/org/transitclock/custom/mbta/BusLocAvlModule.java b/transitclock/src/main/java/org/transitclock/custom/mbta/BusLocAvlModule.java index a4c41d96e..36c253eda 100644 --- a/transitclock/src/main/java/org/transitclock/custom/mbta/BusLocAvlModule.java +++ b/transitclock/src/main/java/org/transitclock/custom/mbta/BusLocAvlModule.java @@ -105,7 +105,7 @@ protected Collection processData(InputStream in) throws Exception { JSONObject vehiclePosition=vehicle.getJSONObject("position"); JSONObject vehicleTrip=vehicle.getJSONObject("trip"); - if(vehicleTrip.getString("route_id")!=null && (mbtaTestRoute==null || vehicleTrip.getString("route_id").equals(mbtaTestRoute.getValue()))) + if(vehicleTrip.has("route_id") && (mbtaTestRoute==null || vehicleTrip.getString("route_id").equals(mbtaTestRoute.getValue()))) { String blockid=vehicle.getString("block_id"); long timestamp=vehicle.getLong("timestamp");