Skip to content

Commit

Permalink
Fixed null reference bug in some direct rules
Browse files Browse the repository at this point in the history
  • Loading branch information
summerhenson committed Jul 19, 2024
1 parent 4b7e1e9 commit 4d8a7c7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public RegionsWithinColumnsDirectRule() {
public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) {
ColumnsWithinRegionsDirectRule correspondingRule = new ColumnsWithinRegionsDirectRule();
String result = correspondingRule.checkRuleRawAt(transition, puzzleElement);
if (result.equals("Only black out cells outside the column(s)!")) {
if (result != null && result.equals("Only black out cells outside the column(s)!")) {
return "Only black out cells outside the region(s)!";
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem

RowsWithinRegionsDirectRule correspondingRule = new RowsWithinRegionsDirectRule();
String result = correspondingRule.checkRuleRawAt(transition, puzzleElement);
if (result.equals("Only black out cells outside the row(s)!")) {
if (result != null && result.equals("Only black out cells outside the row(s)!")) {
return "Only black out cells outside the region(s)!";
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem

ColumnsWithinRowsDirectRule correspondingRule = new ColumnsWithinRowsDirectRule();
String result = correspondingRule.checkRuleRawAt(transition, puzzleElement);
if (result.equals("Only black out cells outside the column(s)!")) {
if (result != null && result.equals("Only black out cells outside the column(s)!")) {
return "Only black out cells outside the row(s)!";
}
return result;
Expand Down

0 comments on commit 4d8a7c7

Please sign in to comment.