summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-11-28 12:23:38 +0000
committerMiklos Vajna <vmiklos@collabora.com>2019-01-11 16:36:41 +0100
commitf100b106a52561f8a1934b4c3198712d7e9c464f (patch)
tree0d8d957b0c576476e82a8509a19a3f16d88774fb
parent71fad56863301f47f19fdd47ab93099ad098474e (diff)
Resolves: tdf#112215 null deref on missing optional ppd value
Change-Id: Iba45437332df963e1aa213c587071ab293f36390 Reviewed-on: https://gerrit.libreoffice.org/64165 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index af2dfbe0e249..7668701f91cb 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -852,13 +852,22 @@ PPDParser::PPDParser( const OUString& rFile ) :
}
// fill in direct values
- if( (pKey = getKey( OUString( "ColorDevice" ) )) )
- m_bColorDevice = pKey->getValue( 0 )->m_aValue.startsWithIgnoreAsciiCase( "true" );
+ if ((pKey = getKey(OUString("ColorDevice"))))
+ {
+ if (const PPDValue* pValue = pKey->getValue(0))
+ m_bColorDevice = pValue->m_aValue.startsWithIgnoreAsciiCase("true");
+ }
- if( (pKey = getKey( OUString( "LanguageLevel" ) )) )
- m_nLanguageLevel = pKey->getValue( 0 )->m_aValue.toInt32();
- if( (pKey = getKey( OUString( "TTRasterizer" ) )) )
- m_bType42Capable = pKey->getValue( 0 )->m_aValue.equalsIgnoreAsciiCase( "Type42" );
+ if ((pKey = getKey(OUString("LanguageLevel"))))
+ {
+ if (const PPDValue* pValue = pKey->getValue(0))
+ m_nLanguageLevel = pValue->m_aValue.toInt32();
+ }
+ if ((pKey = getKey(OUString("TTRasterizer"))))
+ {
+ if (const PPDValue* pValue = pKey->getValue(0))
+ m_bType42Capable = pValue->m_aValue.equalsIgnoreAsciiCase( "Type42" );
+ }
}
PPDParser::~PPDParser()