Skip to content

Commit b18b7a7

Browse files
author
gitlab
committed
Merge branch 'fix/ZSTAC-82118@@2' into '5.5.6'
<fix>[network]: Fix potential npe in DhcpExtension See merge request zstackio/zstack!9168
2 parents 765d1de + 42fabc0 commit b18b7a7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

network/src/main/java/org/zstack/network/service/DhcpExtension.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,13 @@ private DhcpStruct getDhcpStruct(VmInstanceInventory vm, List<VmInstanceSpec.Hos
155155
String hostname = CollectionUtils.find(hostNames, new Function<String, HostName>() {
156156
@Override
157157
public String call(HostName arg) {
158-
return arg.getL3NetworkUuid().equals(l3.getUuid()) ? arg.getHostname() : null;
158+
if (arg == null || l3 == null) {
159+
return null;
160+
}
161+
if (Objects.equals(arg.getL3NetworkUuid(), l3.getUuid())) {
162+
return arg.getHostname();
163+
}
164+
return null;
159165
}
160166
});
161167
if (hostname != null && l3.getDnsDomain() != null) {

0 commit comments

Comments
 (0)