From 5c4b5c26b099c0655983841051b475ffa06c1e37 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 29 Aug 2013 10:15:33 +0100 Subject: orig code guarded against matching on the first char as well as not matching anywhere Change-Id: Id4e46943189e19421b6f9fbc38d51d542d9428b6 --- sfx2/source/doc/new.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sfx2/source/doc/new.cxx') diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 7b52d8cad61b..e92833a49d24 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -286,7 +286,7 @@ IMPL_LINK( SfxNewFileDialog_Impl, RegionSelect, ListBox *, pBox ) aTemplateLb.Clear(); OUString aSel = aRegionLb.GetSelectEntry(); sal_Int32 nc = aSel.indexOf('('); - if (nc != -1) + if (nc != -1 && nc != 0) aSel = aSel.replaceAt(nc-1, 1, ""); if ( aSel.compareToIgnoreAsciiCase( SfxResId(STR_STANDARD).toString() ) == 0 ) aTemplateLb.InsertEntry(aNone); @@ -374,7 +374,7 @@ sal_uInt16 SfxNewFileDialog_Impl::GetSelectedTemplatePos() const sal_uInt16 nEntry = aTemplateLb.GetSelectEntryPos(); OUString aSel = aRegionLb.GetSelectEntry(); sal_Int32 nc = aSel.indexOf('('); - if (nc!= -1) + if (nc != -1 && nc != 0) aSel = aSel.replaceAt(nc-1, 1, ""); if ( aSel.compareToIgnoreAsciiCase(SfxResId(STR_STANDARD).toString()) != 0 ) nEntry++; -- cgit