tracker: Fix PVS V595

Add NULL check for 'ContainerWindow()', since it might return NULL.

Change-Id: I0a9e7243c6d23be7559331dcd72e0675eb44809e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2161
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Murai Takashi
2020-11-27 07:19:56 +00:00
committed by Adrien Destugues
parent c144c17f4f
commit 0404495f3b
+5 -4
View File
@@ -8443,7 +8443,8 @@ BPoseView::SwitchDir(const entry_ref* newDirRef, AttributeStreamNode* node)
// check if model is a trash dir, if so // check if model is a trash dir, if so
// update ContainerWindow's fIsTrash, etc. // update ContainerWindow's fIsTrash, etc.
// variables to indicate new state // variables to indicate new state
ContainerWindow()->UpdateIfTrash(model); if (ContainerWindow() != NULL)
ContainerWindow()->UpdateIfTrash(model);
StopWatching(); StopWatching();
ClearPoses(); ClearPoses();
@@ -8462,14 +8463,14 @@ BPoseView::SwitchDir(const entry_ref* newDirRef, AttributeStreamNode* node)
if (viewStateRestored) { if (viewStateRestored) {
if (ViewMode() == kListMode && oldMode != kListMode) { if (ViewMode() == kListMode && oldMode != kListMode) {
if (ContainerWindow()) if (ContainerWindow() != NULL)
ContainerWindow()->ShowAttributeMenu(); ContainerWindow()->ShowAttributeMenu();
fTitleView->Show(); fTitleView->Show();
} else if (ViewMode() != kListMode && oldMode == kListMode) { } else if (ViewMode() != kListMode && oldMode == kListMode) {
fTitleView->Hide(); fTitleView->Hide();
if (ContainerWindow()) if (ContainerWindow() != NULL)
ContainerWindow()->HideAttributeMenu(); ContainerWindow()->HideAttributeMenu();
} else if (ViewMode() == kListMode && oldMode == kListMode) } else if (ViewMode() == kListMode && oldMode == kListMode)
fTitleView->Invalidate(); fTitleView->Invalidate();
@@ -8501,7 +8502,7 @@ BPoseView::SwitchDir(const entry_ref* newDirRef, AttributeStreamNode* node)
// be sure this happens after origin is set and window is sized // be sure this happens after origin is set and window is sized
// properly for proper icon caching! // properly for proper icon caching!
if (ContainerWindow()->IsTrash()) if (ContainerWindow() != NULL && ContainerWindow()->IsTrash())
AddTrashPoses(); AddTrashPoses();
else else
AddPoses(TargetModel()); AddPoses(TargetModel());