[ONOS-6503] Potential null object dereferenced before checking for null
Change-Id: I3a00d02936ff8ef7dcf49e24a5ea3ea36d7b3781
diff --git a/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java b/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java
index cf34a40..e9990c3 100644
--- a/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java
+++ b/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java
@@ -146,7 +146,7 @@
public <T> T post(DeviceId device, String request, InputStream payload, MediaType mediaType,
Class<T> responseClass) {
Response response = getResponse(device, request, payload, mediaType);
- if (response.hasEntity()) {
+ if (response != null && response.hasEntity()) {
return response.readEntity(responseClass);
}
log.error("Response from device {} for request {} contains no entity", device, request);