Kaydet (Commit) dd70861f authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz: ensure nOldSize is > 0

Change-Id: Iaf385c9cd4fd37d56879908c00c7483762d66a0b
üst 1e3879f7
...@@ -556,7 +556,7 @@ void OS2METReader::AddPointsToArea(const tools::Polygon & rPoly) ...@@ -556,7 +556,7 @@ void OS2METReader::AddPointsToArea(const tools::Polygon & rPoly)
else { else {
tools::Polygon aLastPoly(pPP->GetObject(pPP->Count()-1)); tools::Polygon aLastPoly(pPP->GetObject(pPP->Count()-1));
nOldSize=aLastPoly.GetSize(); nOldSize=aLastPoly.GetSize();
if (aLastPoly.GetPoint(nOldSize-1)==rPoly.GetPoint(0)) nOldSize--; if (nOldSize && aLastPoly.GetPoint(nOldSize-1)==rPoly.GetPoint(0)) nOldSize--;
nNewSize=nOldSize+rPoly.GetSize(); nNewSize=nOldSize+rPoly.GetSize();
aLastPoly.SetSize(nNewSize); aLastPoly.SetSize(nNewSize);
for (i=nOldSize; i<nNewSize; i++) { for (i=nOldSize; i<nNewSize; i++) {
...@@ -577,7 +577,7 @@ void OS2METReader::AddPointsToPath(const tools::Polygon & rPoly) ...@@ -577,7 +577,7 @@ void OS2METReader::AddPointsToPath(const tools::Polygon & rPoly)
else { else {
tools::Polygon aLastPoly(pPP->GetObject(pPP->Count()-1)); tools::Polygon aLastPoly(pPP->GetObject(pPP->Count()-1));
nOldSize=aLastPoly.GetSize(); nOldSize=aLastPoly.GetSize();
if (aLastPoly.GetPoint(nOldSize-1)!=rPoly.GetPoint(0)) pPP->Insert(rPoly); if (nOldSize && aLastPoly.GetPoint(nOldSize-1)!=rPoly.GetPoint(0)) pPP->Insert(rPoly);
else { else {
nOldSize--; nOldSize--;
nNewSize=nOldSize+rPoly.GetSize(); nNewSize=nOldSize+rPoly.GetSize();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment