diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-06-08 21:58:18 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-06-08 21:59:19 +0200 |
commit | 6b379300ad3fdbc5c58901c6e06fe600367f83c0 (patch) | |
tree | 0d447c92f9960ad2b1d23f1f7fc875b2056394bf /sw | |
parent | 43941d9a5313fcd7fe39a61bd2eace64f7743486 (diff) |
Check pointer before deferenging
Change-Id: I9bf9ad249afc88379d66337059a73297880acd83
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/swserv.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/basflt/shellio.cxx | 30 |
2 files changed, 24 insertions, 13 deletions
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index e2a34af26914..476767d9b90d 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -78,12 +78,17 @@ sal_Bool SwServerObject::GetData( uno::Any & rData, case SECTION_SERVER: pPam = new SwPaM( SwPosition( *CNTNT_TYPE.pSectNd ) ); + if (!pPam) + { + break; + } pPam->Move( fnMoveForward ); pPam->SetMark(); pPam->GetPoint()->nNode = *CNTNT_TYPE.pSectNd->EndOfSectionNode(); pPam->Move( fnMoveBackward ); break; - case NONE_SERVER: break; + case NONE_SERVER: + break; } if( pPam ) diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index a17f91d54094..af7750396518 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -830,9 +830,12 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName ) else { pPam = new SwPaM( *pPam ); - pPam->Move( fnMoveBackward, fnGoDoc ); - pPam->SetMark(); - pPam->Move( fnMoveForward, fnGoDoc ); + if (pPam) + { + pPam->Move( fnMoveBackward, fnGoDoc ); + pPam->SetMark(); + pPam->Move( fnMoveForward, fnGoDoc ); + } } } // pPam ist immer noch der akt. Cursor !! @@ -842,16 +845,19 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName ) // keine Shell oder alles schreiben -> eigenen Pam erzeugen SwDoc* pOutDoc = pDoc ? pDoc : &rDoc; pPam = new SwPaM( pOutDoc->GetNodes().GetEndOfContent() ); - if( pOutDoc->IsClipBoard() ) + if (pPam) { - pPam->Move( fnMoveBackward, fnGoDoc ); - pPam->SetMark(); - pPam->Move( fnMoveForward, fnGoDoc ); - } - else - { - pPam->SetMark(); - pPam->Move( fnMoveBackward, fnGoDoc ); + if( pOutDoc->IsClipBoard() ) + { + pPam->Move( fnMoveBackward, fnGoDoc ); + pPam->SetMark(); + pPam->Move( fnMoveForward, fnGoDoc ); + } + else + { + pPam->SetMark(); + pPam->Move( fnMoveBackward, fnGoDoc ); + } } } |