Tracker: Fix CanEditName() crash (from hrev57402)
Although I can't reproduce this crash, from the looks of the crash report something in the CanEditName() method is throwing a segmentation fault. If selection count is not 1, don't even try to get the selection, Edit name is not allowed unless you have a single item selected. Double check that selected item is not NULL before using it. I refuse to believe that fSelectionList being NULL is the problem here, more likely fSelectionList->FirstItem() is NULL and is the cause of the crash. Bailing out after checking that selection count is 1 should ensure that FirstItem() is not NULL. Hopefully fixes #18684 Change-Id: Ib99192178fa6f6d31b389afb47e72c5513e6e1c6 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7139 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
f5029bd569
commit
ac83e7f073
@@ -8907,12 +8907,12 @@ BPoseView::TargetVolumeIsReadOnly() const
|
|||||||
bool
|
bool
|
||||||
BPoseView::CanEditName() const
|
BPoseView::CanEditName() const
|
||||||
{
|
{
|
||||||
const int32 selectCount = CountSelected();
|
if (CountSelected() != 1)
|
||||||
Model* selected = fSelectionList->FirstItem()->TargetModel();
|
return false;
|
||||||
|
|
||||||
return !ActivePose() && selectCount == 1
|
Model* selected = fSelectionList->FirstItem()->TargetModel();
|
||||||
&& !selected->IsDesktop() && !selected->IsRoot()
|
return !ActivePose() && selected != NULL && !selected->IsDesktop()
|
||||||
&& !selected->IsTrash();
|
&& !selected->IsRoot() && !selected->IsTrash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user