shedaniel 4 лет назад
Родитель
Сommit
12680fde12

+ 1 - 1
build.gradle

@@ -1,5 +1,5 @@
 plugins {
-    id "architect-plugin" version "1.2.29"
+    id "architect-plugin" version "1.2.33"
     id "org.cadixdev.licenser" version "0.5.0"
     id "com.jfrog.bintray" version "1.8.4"
     id "com.matthewprenger.cursegradle" version "1.4.0" apply false

+ 4 - 1
common/src/main/java/me/shedaniel/architectury/utils/Fraction.java

@@ -57,7 +57,10 @@ public final class Fraction extends Number implements Comparable<Fraction> {
     
     public static Fraction ofWhole(long whole) {
         if (whole >= -1024 && whole < 1024) {
-            return SIMPLE_CACHE[(int) whole + 1024];
+            Fraction cached = SIMPLE_CACHE[(int) whole + 1024];
+            if (cached != null) {
+                return cached;
+            }
         }
         return new Fraction(whole, 1);
     }