diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-08-19 20:46:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-08-20 10:35:10 +0100 |
commit | 170ff56b1b99ec451e9adbc9ae9c2a94dd47a692 (patch) | |
tree | 60622724f2cb775f24706c2abee09de81540e271 /sfx2 | |
parent | 47d1cb09e6bcf8b044d15fff1be9b76fe72524b0 (diff) |
it's no use to check for stream status after a seek
seek resets failures, need to check after a read
and before a seek
Change-Id: Ia249e258c51af5efc838f92c4ead6237b403c701
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/oleprops.cxx | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index 055355b4b675..6552c9e1edef 100644 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -1226,19 +1226,22 @@ void SfxOlePropertySet::ImplLoad( SvStream& rStrm ) // read sections sal_Size nSectPosPos = rStrm.Tell(); - for( sal_Int32 nSectIdx = 0; (nSectIdx < nSectCount) && (rStrm.GetErrorCode() == SVSTREAM_OK) && !rStrm.IsEof(); ++nSectIdx ) + for (sal_Int32 nSectIdx = 0; nSectIdx < nSectCount; ++nSectIdx) { // read section guid/position pair - rStrm.Seek( nSectPosPos ); + rStrm.Seek(nSectPosPos); SvGlobalName aSectGuid; - sal_uInt32 nSectPos; rStrm >> aSectGuid; - rStrm.ReadUInt32( nSectPos ); + sal_uInt32 nSectPos(0); + rStrm.ReadUInt32(nSectPos); + if (!rStrm.good()) + break; nSectPosPos = rStrm.Tell(); // read section - rStrm.Seek( static_cast< sal_Size >( nSectPos ) ); - if( rStrm.GetErrorCode() == SVSTREAM_OK ) - LoadObject( rStrm, AddSection( aSectGuid ) ); + rStrm.Seek(nSectPos); + LoadObject(rStrm, AddSection(aSectGuid)); + if (!rStrm.good()) + break; } } |