summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-07-22 10:59:35 -0400
committerRye Mutt <rye@alchemyviewer.org>2024-07-22 10:59:35 -0400
commit3bd774894f651b0f1a300909193af8299fe3dabc (patch)
tree38e39f536d2f2b7ccb8ae964dc294914625932a8
parent75799eb22b546de8130190479c57ce112f973c80 (diff)
Fix nullptr crash in handleVSyncChanged
-rw-r--r--indra/newview/llviewercontrol.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 1d483f1b8a..0e1f4c09c7 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -263,12 +263,15 @@ static bool handleAnisotropicChanged(const LLSD& newvalue)
static bool handleVSyncChanged(const LLSD& newvalue)
{
LLPerfStats::tunables.vsyncEnabled = newvalue.asBoolean();
- gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean());
-
- if (newvalue.asBoolean())
+ if (gViewerWindow && gViewerWindow->getWindow())
{
- U32 current_target = gSavedSettings.getU32("TargetFPS");
- gSavedSettings.setU32("TargetFPS", std::min((U32)gViewerWindow->getWindow()->getRefreshRate(), current_target));
+ gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean());
+
+ if (newvalue.asBoolean())
+ {
+ U32 current_target = gSavedSettings.getU32("TargetFPS");
+ gSavedSettings.setU32("TargetFPS", std::min((U32)gViewerWindow->getWindow()->getRefreshRate(), current_target));
+ }
}
return true;