@@ -154,7 +154,8 @@ public final boolean deleteProject(final int projectId) throws AutomateException
154154 .routeParam ("projectId" , "" + projectId )
155155 .asJsonObject ();
156156
157- return (result != null && result .path ("status" ).asText ("" ).equals ("ok" ));
157+ String status = (result != null ) ? result .path ("status" ).asText () : null ;
158+ return (status != null ) && status .equals ("ok" );
158159 } catch (BrowserStackException e ) {
159160 throw new AutomateException (e );
160161 }
@@ -280,7 +281,8 @@ public final boolean deleteBuild(final String buildId) throws AutomateException
280281 .routeParam ("buildId" , buildId )
281282 .asJsonObject ();
282283
283- return (result != null && result .path ("status" ).asText ("" ).equals ("ok" ));
284+ String status = (result != null ) ? result .path ("status" ).asText () : null ;
285+ return (status != null && status .equals ("ok" ));
284286 } catch (BrowserStackException e ) {
285287 throw new AutomateException (e );
286288 }
@@ -522,7 +524,8 @@ public final boolean deleteSession(final String sessionId) throws SessionNotFoun
522524 .routeParam ("sessionId" , sessionId )
523525 .asJsonObject ();
524526
525- return (result != null && result .path ("status" ).asText ("" ).equals ("ok" ));
527+ String status = (result != null ) ? result .path ("status" ).asText () : null ;
528+ return (status != null && status .equals ("ok" ));
526529 } catch (BrowserStackException e ) {
527530 throw new AutomateException (e );
528531 }
0 commit comments