Skip to content

Commit

Permalink
Bug 1727289 - null-check root pres context to avoid crashes on automa…
Browse files Browse the repository at this point in the history
…tion in some cases.

​
MANUAL PUSH: Trivial orange fix CLOSED TREE
​
  • Loading branch information
CosminSabou committed Aug 30, 2021
1 parent 38d10db commit c859adb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions widget/nsNativeBasicTheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,10 @@ static std::pair<sRGBColor, sRGBColor> SystemColorPair(
/* static */
auto nsNativeBasicTheme::GetDPIRatioForScrollbarPart(nsPresContext* aPc)
-> DPIRatio {
if (auto* widget = aPc->GetRootPresContext()->GetRootWidget()) {
return widget->GetDefaultScale();
if (auto* rootPc = aPc->GetRootPresContext()) {
if (auto* widget = rootPc->GetRootWidget()) {
return widget->GetDefaultScale();
}
}
return DPIRatio(float(AppUnitsPerCSSPixel()) /
aPc->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
Expand Down

0 comments on commit c859adb

Please sign in to comment.