summaryrefslogtreecommitdiff
path: root/connectivity/source/commontools/DateConversion.cxx
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2014-08-20 10:06:26 +0200
committerDavid Tardon <dtardon@redhat.com>2014-08-20 10:08:49 +0200
commit34d6e7790f17080bea95ad770a819c7b5159b4c4 (patch)
tree1e370214c70840f8c1248325a894344515323c7c /connectivity/source/commontools/DateConversion.cxx
parent8c536baf2072295691711927e262d2341d14a3e1 (diff)
avoid potential null dereference
Change-Id: I2236a18608ffa9481c30088044f34e1a3372dd11
Diffstat (limited to 'connectivity/source/commontools/DateConversion.cxx')
-rw-r--r--connectivity/source/commontools/DateConversion.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx
index 373d048ab37b..cf6fbe13bd78 100644
--- a/connectivity/source/commontools/DateConversion.cxx
+++ b/connectivity/source/commontools/DateConversion.cxx
@@ -255,9 +255,13 @@ void DBTypeConversion::setValue(const Reference<XColumnUpdate>& xVariant,
sal_Int32 nStandardKey(0);
if(xFormatTypes.is())
{
- css::lang::Locale loc;
- if (xFormats->getByKey(nKeyToUse)->getPropertyValue("Locale") >>= loc)
- nStandardKey = xFormatTypes->getStandardIndex(loc);
+ const Reference< XPropertySet > xFormatProps(xFormats->getByKey(nKeyToUse));
+ if (xFormatProps.is())
+ {
+ css::lang::Locale loc;
+ if (xFormatProps->getPropertyValue("Locale") >>= loc)
+ nStandardKey = xFormatTypes->getStandardIndex(loc);
+ }
}
// Why use nStandardKey rather than nKeyToUse here? Don't know, but "it was always like that".
// Previously had hardcoded 0 instead of nStandardKey, which led to problems with dates