mirror of https://github.com/apache/cloudstack.git
The code implies resource could be null, and yet de-references resource before the null check. As I was experiencing a NPE because if this exact scenario, put the remote agent check inside the check for null to avoid problems. If resource is null we log that we were unable to send ping due to agent disconnected...
This commit is contained in:
parent
2185adc086
commit
e168760295
|
|
@ -125,11 +125,11 @@ public class DirectAgentAttache extends AgentAttache {
|
|||
try {
|
||||
ServerResource resource = _resource;
|
||||
|
||||
if (resource.IsRemoteAgent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (resource != null) {
|
||||
if (resource != null) {
|
||||
if (resource.IsRemoteAgent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PingCommand cmd = resource.getCurrentStatus(_id);
|
||||
if (cmd == null) {
|
||||
s_logger.warn("Unable to get current status on " + _id);
|
||||
|
|
|
|||
Loading…
Reference in New Issue