diff options
author | Kurt Zenker <kz@openoffice.org> | 2005-01-13 17:58:36 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2005-01-13 17:58:36 +0000 |
commit | 268c606ec70f1110a78c16420b31fba80a8aa81e (patch) | |
tree | da930dcaadf6641a5e6c3f51f96cd2ebcc5145d2 /stoc | |
parent | ba74180ce265c8c6efc11d460418835a5e309c39 (diff) |
INTEGRATION: CWS cd02 (1.2.164); FILE MERGED
2004/11/15 16:17:36 dbo 1.2.164.1: #114661# making code more robust, source and destination reference
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/implementationregistration/mergekeys.cxx | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/stoc/source/implementationregistration/mergekeys.cxx b/stoc/source/implementationregistration/mergekeys.cxx index a796ff1446d9..d866cfd28014 100644 --- a/stoc/source/implementationregistration/mergekeys.cxx +++ b/stoc/source/implementationregistration/mergekeys.cxx @@ -2,9 +2,9 @@ * * $RCSfile: mergekeys.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dbo $ $Date: 2002-06-07 15:14:15 $ + * last change: $Author: kz $ $Date: 2005-01-13 18:58:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,6 +64,8 @@ #include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/registry/MergeConflictException.hpp> +#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) + using namespace ::rtl; using namespace ::osl; using namespace ::com::sun::star::uno; @@ -91,7 +93,16 @@ static void mergeKeys( t_links & links ) SAL_THROW( (registry::InvalidRegistryException, registry::MergeConflictException) ) { - OSL_ASSERT( xDest->isValid() && xSource->isValid() ); + if (!xSource.is() || !xSource->isValid()) { + throw registry::InvalidRegistryException( + OUSTR("source key is null or invalid!"), + Reference<XInterface>() ); + } + if (!xDest.is() || !xDest->isValid()) { + throw registry::InvalidRegistryException( + OUSTR("destination key is null or invalid!"), + Reference<XInterface>() ); + } // write value switch (xSource->getValueType()) @@ -174,6 +185,11 @@ void SAL_CALL mergeKeys( Reference< registry::XRegistryKey > const & xSource ) SAL_THROW( (registry::InvalidRegistryException, registry::MergeConflictException) ) { + if (!xDest.is() || !xDest->isValid()) { + throw registry::InvalidRegistryException( + OUSTR("destination key is null or invalid!"), + Reference<XInterface>() ); + } if (xDest->isReadOnly()) { throw registry::InvalidRegistryException( |