Skip to content

Commit

Permalink
Fix a NullPointerException being thrown when reporting custom errors
Browse files Browse the repository at this point in the history
Fixes #177
  • Loading branch information
haykam821 authored and Restioson committed Jun 10, 2024
1 parent 311cbbc commit 992efbf
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ public static void onServerCrash(CrashReport report) {
public static void reportCustom(CustomErrorType type, Throwable throwable) {
var now = Instant.now();
var lastReport = LAST_REPORT.get(type);
var timeSinceLastReport = Duration.between(lastReport, now);
if (timeSinceLastReport.compareTo(type.reportInterval) < 0) {
return;

if (lastReport != null) {
var timeSinceLastReport = Duration.between(lastReport, now);
if (timeSinceLastReport.compareTo(type.reportInterval) < 0) {
return;
}
}

if (!LAST_REPORT.replace(type, lastReport, now)) {
Expand Down

0 comments on commit 992efbf

Please sign in to comment.