diff options
-rw-r--r-- | extensions/source/resource/ResourceIndexAccess.cxx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/extensions/source/resource/ResourceIndexAccess.cxx b/extensions/source/resource/ResourceIndexAccess.cxx index 523a5fd5abd3..7b99e83ef5af 100644 --- a/extensions/source/resource/ResourceIndexAccess.cxx +++ b/extensions/source/resource/ResourceIndexAccess.cxx @@ -70,7 +70,7 @@ namespace ResourceIndexAccessBase( ::boost::shared_ptr<ResMgr> pResMgr) : m_pResMgr(pResMgr) { - OSL_ENSURE(m_pResMgr, "no ressource manager given"); + OSL_ENSURE(m_pResMgr, "no resource manager given"); } // XIndexAccess @@ -122,7 +122,7 @@ Reference<XInterface> initResourceIndexAccess(ResourceIndexAccess* pResourceInde // and will crash on getByIndex calls, better just give back an empty Reference // so that such ResourceStringIndexAccess instances are never release into the wild throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("ressource manager could not get initialized")), + OUString(RTL_CONSTASCII_USTRINGPARAM("resource manager could not get initialized")), /* xResult */ Reference<XInterface>()); return xResult; } @@ -172,12 +172,19 @@ Any SAL_CALL ResourceStringIndexAccess::getByIndex(sal_Int32 nIdx) if(nIdx > SAL_MAX_UINT16 || nIdx < 0) throw IndexOutOfBoundsException(); SolarMutexGuard aGuard; + if(!m_pResMgr.get()) + throw RuntimeException( + OUString(RTL_CONSTASCII_USTRINGPARAM("resource manager not available")), + Reference<XInterface>()); + const ResId aId(static_cast<sal_uInt16>(nIdx), *m_pResMgr); aId.SetRT(RSC_STRING); + if(!m_pResMgr->IsAvailable(aId)) throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("string ressource for id not available")), + OUString(RTL_CONSTASCII_USTRINGPARAM("string resource for id not available")), Reference<XInterface>()); + return makeAny(OUString(String(aId))); } @@ -187,11 +194,17 @@ Any SAL_CALL ResourceStringListIndexAccess::getByIndex(sal_Int32 nIdx) if(nIdx > SAL_MAX_UINT16 || nIdx < 0) throw IndexOutOfBoundsException(); SolarMutexGuard aGuard; + + if(!m_pResMgr.get()) + throw RuntimeException( + OUString(RTL_CONSTASCII_USTRINGPARAM("resource manager not available")), + Reference<XInterface>()); + const ResId aId(static_cast<sal_uInt16>(nIdx), *m_pResMgr); aId.SetRT(RSC_STRINGARRAY); if(!m_pResMgr->IsAvailable(aId)) throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("string list ressource for id not available")), + OUString(RTL_CONSTASCII_USTRINGPARAM("string list resource for id not available")), Reference<XInterface>()); const ResStringArray aStringList(aId); Sequence<PropertyValue> aPropList(aStringList.Count()); |