Skip to content

Commit

Permalink
Resolved the crash when inverting the worksheet (#1951)
Browse files Browse the repository at this point in the history
  • Loading branch information
gunterkoenigsmann committed Sep 5, 2024
1 parent 8876e4d commit 83722f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Current

- A Spanish translation update by cyphra.
- Resolved a crash when inverting the worksheet (#1951)

# 24.08.0

Expand Down
9 changes: 6 additions & 3 deletions src/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1411,9 +1411,12 @@ wxColor Configuration::MakeColorDifferFromBackground(wxColor color) {
return InvertColour(color);
} else {
int maxOldCol = std::max(std::max(color.Red(), color.Green()), color.Blue());
return wxColour(newBrightness * color.Red() / maxOldCol,
newBrightness * color.Green() / maxOldCol,
newBrightness * color.Blue() / maxOldCol);
if (maxOldCol < 1)
return *wxWHITE;
else
return wxColour(newBrightness * color.Red() / maxOldCol,
newBrightness * color.Green() / maxOldCol,
newBrightness * color.Blue() / maxOldCol);
}
}

Expand Down

0 comments on commit 83722f8

Please sign in to comment.