From 7224b69bd52bc3544e2b4d36ccf36965d3c3c45e Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Sun, 12 Aug 2018 21:59:56 +0200 Subject: [PATCH] Early bailout Change-Id: I34cb0f151b35fe775008d449bf7efb72ae81f29d --- sc/source/ui/miscdlgs/anyrefdg.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index cc98f3d8d11e..6de58331021f 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -875,13 +875,15 @@ void ScRefHandler::SwitchToDocument() bool ScRefHandler::IsDocAllowed(SfxObjectShell* pDocSh) const // pDocSh may be 0 { - // default: allow only same document (overridden in function dialog) - OUString aCmpName; - if ( pDocSh ) - aCmpName = pDocSh->GetTitle(); - // if aDocName isn't initialized, allow - return ( m_aDocName.isEmpty() || m_aDocName == aCmpName ); + if ( m_aDocName.isEmpty() ) + return true; + + if ( !pDocSh ) + return false; + + // default: allow only same document (overridden in function dialog) + return m_aDocName==pDocSh->GetTitle(); } bool ScRefHandler::IsRefInputMode() const