fix multiplayer crash

This commit is contained in:
2025-02-03 11:32:17 +01:00
parent 11a246adfd
commit 7dd3f198db

View File

@@ -71,24 +71,28 @@ public class SudokuRenderer {
private void renderPopup() {
if (ImGui.beginPopup("editPopup")) {
Block block = currentCell.getBlock();
int symbolCount = block.getCells().size();
for (int i = 0; i < symbolCount; i++) {
if ((i + 1) % (int) (Math.sqrt(symbolCount)) != 1)
ImGui.sameLine();
if (currentCell.getSymbolIndex() == i) {
if (ImGui.button("X", cellSize)) {
currentCell.setSymbolIndex(Cell.NOSYMBOL);
this.onCellChange.emit(currentCell);
ImGui.closeCurrentPopup();
}
} else {
if (ImGui.button(Options.Symboles.getSymbols().get(i), cellSize)) {
currentCell.setSymbolIndex(i);
this.onCellChange.emit(currentCell);
if (this.doku.getDoku().isSolved())
this.onResolve.emit();
ImGui.closeCurrentPopup();
if (currentCell == null)
ImGui.closeCurrentPopup();
else {
Block block = currentCell.getBlock();
int symbolCount = block.getCells().size();
for (int i = 0; i < symbolCount; i++) {
if ((i + 1) % (int) (Math.sqrt(symbolCount)) != 1)
ImGui.sameLine();
if (currentCell.getSymbolIndex() == i) {
if (ImGui.button("X", cellSize)) {
currentCell.setSymbolIndex(Cell.NOSYMBOL);
this.onCellChange.emit(currentCell);
ImGui.closeCurrentPopup();
}
} else {
if (ImGui.button(Options.Symboles.getSymbols().get(i), cellSize)) {
currentCell.setSymbolIndex(i);
this.onCellChange.emit(currentCell);
if (this.doku.getDoku().isSolved())
this.onResolve.emit();
ImGui.closeCurrentPopup();
}
}
}
}