Skip to content

Commit

Permalink
🎨 Improve structure / format of the code. 优化代码防止无状态下调用的NPE异常
Browse files Browse the repository at this point in the history
  • Loading branch information
721806280 committed Apr 28, 2024
1 parent 3772732 commit c953706
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* Enum representing the various occasions on which a notification might be sent during the build process.
Expand Down Expand Up @@ -74,7 +75,7 @@ public enum NoticeOccasionEnum {
* @return The corresponding {@link NoticeOccasionEnum}, or null if no match is found.
*/
public static NoticeOccasionEnum getNoticeOccasion(Result result) {
return RESULT_TO_ENUM_MAP.get(result);
return RESULT_TO_ENUM_MAP.get(Objects.nonNull(result) ? result : Result.SUCCESS);
}

/**
Expand Down

0 comments on commit c953706

Please sign in to comment.