diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx index 235f47fd354936dee4fe7dfdd869912bfb2995c6..4d92ba429528c8e20b1e374816a00f544b22938f 100644 --- a/cui/source/dialogs/hltpbase.cxx +++ b/cui/source/dialogs/hltpbase.cxx @@ -426,7 +426,13 @@ void SvxHyperlinkTabPageBase::GetDataFromCommonFields( OUString& aStrName, aStrIntName = mpEdText->GetText(); aStrName = mpEdIndication->GetText(); aStrFrame = mpCbbFrame->GetText(); - eMode = static_cast(mpLbForm->GetSelectedEntryPos()+1); + + sal_Int32 nPos = mpLbForm->GetSelectedEntryPos(); + if (nPos == LISTBOX_ENTRY_NOTFOUND) + // This happens when FillStandardDlgFields() hides mpLbForm. + nPos = 0; + eMode = static_cast(nPos + 1); + // Ask dialog whether the current doc is a HTML-doc if (static_cast(mpDialog.get())->IsHTMLDoc()) eMode = static_cast( sal_uInt16(eMode) | HLINK_HTMLMODE );