Skip to content

Commit

Permalink
[fix] fix byte type npe. (#2659)
Browse files Browse the repository at this point in the history
Co-authored-by: 刘进山 <[email protected]>
  • Loading branch information
MRgenial and 刘进山 authored Sep 3, 2024
1 parent 4a69177 commit 47e632a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
package org.apache.hertzbeat.manager.service.impl;

import jakarta.persistence.criteria.Predicate;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -130,7 +132,7 @@ public List<Tag> listTag(Set<Long> ids) {
@Override
public void deleteMonitorSystemTags(Monitor monitor) {
if (CollectionUtils.isNotEmpty(monitor.getTags())) {
List<Tag> tags = monitor.getTags().stream().filter(tag -> tag.getType() == (byte) 0).collect(Collectors.toList());
List<Tag> tags = monitor.getTags().stream().filter(tag -> Objects.nonNull(tag.getType()) && tag.getType() == (byte) 0).collect(Collectors.toList());
tagDao.deleteAll(tags);
}
}
Expand Down

0 comments on commit 47e632a

Please sign in to comment.