Fix NPE in ItemGroup concurrency patch
This commit is contained in:
parent
659091c565
commit
4db208332e
1 changed files with 13 additions and 19 deletions
|
@ -40,7 +40,7 @@
|
|||
return this.field_78033_n < 6;
|
||||
}
|
||||
|
||||
@@ -220,4 +225,54 @@
|
||||
@@ -220,4 +225,48 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,16 +72,11 @@
|
|||
+ return 4210752;
|
||||
+ }
|
||||
+
|
||||
+ private static final Object LOCK = new Object();
|
||||
+
|
||||
+ public static int getGroupCountSafe() {
|
||||
+ synchronized (LOCK) {
|
||||
+ public static synchronized int getGroupCountSafe() {
|
||||
+ return ItemGroup.field_78032_a.length;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static int addGroupSafe(int index, ItemGroup newGroup) {
|
||||
+ synchronized (LOCK) {
|
||||
+ private static synchronized int addGroupSafe(int index, ItemGroup newGroup) {
|
||||
+ if(index == -1) {
|
||||
+ index = field_78032_a.length;
|
||||
+ }
|
||||
|
@ -92,6 +87,5 @@
|
|||
+ }
|
||||
+ field_78032_a[index] = newGroup;
|
||||
+ return index;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue