Skip to content

Commit 071dec4

Browse files
XINJIANGMOiche033
andcommitted
Fix crash when setting debug visualization mode while gi is disabled (#3059)
Signed-off-by: momo <[email protected]> Co-authored-by: Ian Chen <[email protected]> (cherry picked from commit 019e38c)
1 parent 6c2997d commit 071dec4

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/gui/plugins/global_illumination_vct/GlobalIlluminationVct.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,21 @@ bool GlobalIlluminationVct::eventFilter(QObject *_obj, QEvent *_event)
479479
}
480480
else if (this->dataPtr->debugVisualizationDirty)
481481
{
482-
this->dataPtr->gi->SetDebugVisualization(
482+
if (this->dataPtr->enabled && this->dataPtr->gi->Enabled())
483+
{
484+
this->dataPtr->gi->SetDebugVisualization(
483485
static_cast<rendering::GlobalIlluminationVct::DebugVisualizationMode>(
484-
this->dataPtr->debugVisMode));
486+
this->dataPtr->debugVisMode));
487+
}
488+
else
489+
{
490+
gzerr << "Trying to set debug visualization mode while GI is "
491+
<< "disabled. Please enable GI first."
492+
<< std::endl;
493+
// Always set to none when disabled to avoid crash
494+
this->dataPtr->gi->SetDebugVisualization(
495+
rendering::GlobalIlluminationVct::DVM_None);
496+
}
485497
this->dataPtr->debugVisualizationDirty = false;
486498
}
487499
}

0 commit comments

Comments
 (0)