Skip to content

Commit

Permalink
fix: исправлена ошибка null exception у стейтов
Browse files Browse the repository at this point in the history
  • Loading branch information
Reider745 committed Mar 2, 2024
1 parent f5bc6a0 commit cfb5b83
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/reider745/block/BlockStateRegisters.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ public static int[] getAllStatesFromId(int runtimeId){
return states;
} // [state1, value1, state2, value2, ...]
public static int runtimeIdByStates(int id, int[] statesAndValues){
Map<String, Integer> state = new HashMap<>();
final Map<String, Integer> state = new HashMap<>();
for(int i = 0;i < statesAndValues.length;i+=2)
state.put(nameByStateId.get(statesAndValues[i]), statesAndValues[i+1]);
return runtimeIdsForStatesAndId.get(id).get(state);
final Integer res = runtimeIdsForStatesAndId.get(id).get(state);
return res == null ? -1 : res;
}// -1 is returned in case it is not found
}

0 comments on commit cfb5b83

Please sign in to comment.