Skip to content

Commit 83722f8

Browse files
Resolved the crash when inverting the worksheet (#1951)
1 parent 8876e4d commit 83722f8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Current
22

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

56
# 24.08.0
67

src/Configuration.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,9 +1411,12 @@ wxColor Configuration::MakeColorDifferFromBackground(wxColor color) {
14111411
return InvertColour(color);
14121412
} else {
14131413
int maxOldCol = std::max(std::max(color.Red(), color.Green()), color.Blue());
1414-
return wxColour(newBrightness * color.Red() / maxOldCol,
1415-
newBrightness * color.Green() / maxOldCol,
1416-
newBrightness * color.Blue() / maxOldCol);
1414+
if (maxOldCol < 1)
1415+
return *wxWHITE;
1416+
else
1417+
return wxColour(newBrightness * color.Red() / maxOldCol,
1418+
newBrightness * color.Green() / maxOldCol,
1419+
newBrightness * color.Blue() / maxOldCol);
14171420
}
14181421
}
14191422

0 commit comments

Comments
 (0)