Skip to content

Commit 091694c

Browse files
committed
Findbugs : NP_NULL_PARAM_DEREF_NONVIRTUAL fixed
1 parent 26b3214 commit 091694c

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// under the License.
1717
package com.cloud.agent.api.routing;
1818

19+
import java.util.Arrays;
20+
1921
import com.cloud.agent.api.Answer;
2022

2123
public class SetStaticRouteAnswer extends Answer {
@@ -26,11 +28,16 @@ protected SetStaticRouteAnswer() {
2628

2729
public SetStaticRouteAnswer(SetStaticRouteCommand cmd, boolean success, String[] results) {
2830
super(cmd, success, null);
29-
assert (cmd.getStaticRoutes().length == results.length) : "Static routes and their results should be the same length";
30-
this.results = results;
31+
if (results != null) {
32+
assert (cmd.getStaticRoutes().length == results.length) : "Static routes and their results should be the same length";
33+
this.results = Arrays.copyOf(results, results.length);
34+
}
3135
}
3236

3337
public String[] getResults() {
34-
return results;
38+
if (results != null) {
39+
return Arrays.copyOf(results, results.length);
40+
}
41+
return null;
3542
}
3643
}

0 commit comments

Comments
 (0)