summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-06-07 12:37:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-06-07 12:44:16 +0100
commit05bab52cd18ce3a1ad699afe5551b217fe59982b (patch)
treeca65af5a95cdf69998784b561006717d294def64
parent0956b4003dc820672f129f5bab459a4a65042a95 (diff)
Resolves: rhbz#710556 don't crash on missing graphics
(cherry picked from commit b883b506e2d4dca419838b56915c58a0030d5b98)
-rw-r--r--oox/source/export/drawingml.cxx28
1 files changed, 14 insertions, 14 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 48f4eb453ee0..f73f569bbe92 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -469,7 +469,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
{
GfxLink aLink = rGraphic.GetLink ();
OUString sMediaType;
- const char* sExtension = NULL;
+ const char* pExtension = "";
OUString sRelId;
SvMemoryStream aStream;
@@ -479,42 +479,42 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
switch ( aLink.GetType() ) {
case GFX_LINK_TYPE_NATIVE_GIF:
sMediaType = US( "image/gif" );
- sExtension = ".gif";
+ pExtension = ".gif";
break;
case GFX_LINK_TYPE_NATIVE_JPG:
sMediaType = US( "image/jpeg" );
- sExtension = ".jpeg";
+ pExtension = ".jpeg";
break;
case GFX_LINK_TYPE_NATIVE_PNG:
sMediaType = US( "image/png" );
- sExtension = ".png";
+ pExtension = ".png";
break;
case GFX_LINK_TYPE_NATIVE_TIF:
sMediaType = US( "image/tiff" );
- sExtension = ".tiff";
+ pExtension = ".tiff";
break;
case GFX_LINK_TYPE_NATIVE_WMF:
sMediaType = US( "image/x-wmf" );
- sExtension = ".wmf";
+ pExtension = ".wmf";
break;
case GFX_LINK_TYPE_NATIVE_MET:
sMediaType = US( "image/x-met" );
- sExtension = ".met";
+ pExtension = ".met";
break;
case GFX_LINK_TYPE_NATIVE_PCT:
sMediaType = US( "image/x-pict" );
- sExtension = ".pct";
+ pExtension = ".pct";
break;
default: {
GraphicType aType = rGraphic.GetType();
if ( aType == GRAPHIC_BITMAP ) {
GraphicConverter::Export( aStream, rGraphic, CVT_PNG );
sMediaType = US( "image/png" );
- sExtension = ".png";
+ pExtension = ".png";
} else if ( aType == GRAPHIC_GDIMETAFILE ) {
GraphicConverter::Export( aStream, rGraphic, CVT_EMF );
sMediaType = US( "image/x-emf" );
- sExtension = ".emf";
+ pExtension = ".emf";
} else {
OSL_TRACE( "unhandled graphic type" );
break;
@@ -526,7 +526,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
}
}
- const char *pComponent = NULL;
+ const char *pComponent = "";
switch ( meDocumentType )
{
case DOCUMENT_DOCX: pComponent = "word"; break;
@@ -538,13 +538,13 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
.appendAscii( pComponent )
.appendAscii( "/media/image" )
.append( (sal_Int32) mnImageCounter )
- .appendAscii( sExtension )
+ .appendAscii( pExtension )
.makeStringAndClear(),
sMediaType );
xOutStream->writeBytes( Sequence< sal_Int8 >( (const sal_Int8*) aData, nDataSize ) );
xOutStream->closeOutput();
- const char *pImagePrefix = NULL;
+ const char *pImagePrefix = "";
switch ( meDocumentType )
{
case DOCUMENT_DOCX:
@@ -561,7 +561,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
OUStringBuffer()
.appendAscii( pImagePrefix )
.append( (sal_Int32) mnImageCounter ++ )
- .appendAscii( sExtension )
+ .appendAscii( pExtension )
.makeStringAndClear() );
return sRelId;