summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-08-19 20:46:16 +0100
committerMichael Stahl <mstahl@redhat.com>2015-08-20 13:36:05 +0000
commit30e4f87f2c8a5d6cd43eab53bf0d0385aca9f563 (patch)
treea132b520b279e533c61c50311b48a448d6f32f65 /sfx2
parent502ca93741bebf6d9c6d2e83cac7b43742078e3e (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 (cherry picked from commit 170ff56b1b99ec451e9adbc9ae9c2a94dd47a692) Reviewed-on: https://gerrit.libreoffice.org/17866 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/oleprops.cxx17
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;
}
}