Skip to content

Commit

Permalink
Try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Nov 11, 2023
1 parent fde53fb commit 0e7608c
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ private void tick(MinecraftServer server) {
}

private static float getAverageTickMs(PerformanceLog log) {
long total = 0;
for (int index = 0; index < log.size(); index++) {
total += log.get(index);
try {
long total = 0;
for (int index = 0; index < log.size(); index++) {
total += log.get(index);
}
double averageTickNs = (double) total / log.size();
return (float) (averageTickNs / 1000000.0);
} catch (Throwable e) {
return 0;
}
double averageTickNs = (double) total / log.size();
return (float) (averageTickNs / 1000000.0);
}
}

0 comments on commit 0e7608c

Please sign in to comment.