Don't crash on unstarted table
Change-Id: I68e596ea37133c89206333e8ca8aa3602878d2fc
This commit is contained in:
parent
d9d28895f7
commit
6f52d47239
2 changed files with 101 additions and 0 deletions
1
external/libabw/UnpackedTarball_libabw.mk
vendored
1
external/libabw/UnpackedTarball_libabw.mk
vendored
|
@ -14,6 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,libabw,$(ABW_TARBALL)))
|
|||
$(eval $(call gb_UnpackedTarball_add_patches,libabw,\
|
||||
external/libabw/libabw-0.0.1-inttypes.patch.1 \
|
||||
external/libabw/libabw-0.0.1-stdstringfromnull.patch.1 \
|
||||
external/libabw/libabw-0.0.1-badtable.patch.1 \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
|
|
100
external/libabw/libabw-0.0.1-badtable.patch.1
vendored
Normal file
100
external/libabw/libabw-0.0.1-badtable.patch.1
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
--- a/src/lib/ABWContentCollector.cpp
|
||||
+++ b/src/lib/ABWContentCollector.cpp
|
||||
@@ -1492,26 +1492,32 @@ void libabw::ABWContentCollector::closeTable()
|
||||
|
||||
void libabw::ABWContentCollector::openCell(const char *props)
|
||||
{
|
||||
- if (props)
|
||||
- parsePropString(props, m_ps->m_tableStates.top().m_currentCellProperties);
|
||||
- int currentRow(0);
|
||||
- if (!findInt(_findCellProperty("top-attach"), currentRow))
|
||||
- currentRow = m_ps->m_tableStates.top().m_currentTableRow + 1;
|
||||
- while (m_ps->m_tableStates.top().m_currentTableRow < currentRow)
|
||||
+ if (!m_ps->m_tableStates.empty())
|
||||
{
|
||||
- if (m_ps->m_tableStates.top().m_currentTableRow >= 0)
|
||||
- _closeTableRow();
|
||||
- _openTableRow();
|
||||
- }
|
||||
+ if (props)
|
||||
+ parsePropString(props, m_ps->m_tableStates.top().m_currentCellProperties);
|
||||
+ int currentRow(0);
|
||||
+ if (!findInt(_findCellProperty("top-attach"), currentRow))
|
||||
+ currentRow = m_ps->m_tableStates.top().m_currentTableRow + 1;
|
||||
+ while (m_ps->m_tableStates.top().m_currentTableRow < currentRow)
|
||||
+ {
|
||||
+ if (m_ps->m_tableStates.top().m_currentTableRow >= 0)
|
||||
+ _closeTableRow();
|
||||
+ _openTableRow();
|
||||
+ }
|
||||
|
||||
- if (!findInt(_findCellProperty("left-attach"), m_ps->m_tableStates.top().m_currentTableCol))
|
||||
- m_ps->m_tableStates.top().m_currentTableCol++;
|
||||
+ if (!findInt(_findCellProperty("left-attach"), m_ps->m_tableStates.top().m_currentTableCol))
|
||||
+ m_ps->m_tableStates.top().m_currentTableCol++;
|
||||
+ }
|
||||
}
|
||||
|
||||
void libabw::ABWContentCollector::closeCell()
|
||||
{
|
||||
- _closeTableCell();
|
||||
- m_ps->m_tableStates.top().m_currentCellProperties.clear();
|
||||
+ if (!m_ps->m_tableStates.empty())
|
||||
+ {
|
||||
+ _closeTableCell();
|
||||
+ m_ps->m_tableStates.top().m_currentCellProperties.clear();
|
||||
+ }
|
||||
}
|
||||
|
||||
void libabw::ABWContentCollector::collectData(const char *, const char *, const WPXBinaryData &)
|
||||
--- a/src/lib/ABWStylesCollector.cpp
|
||||
+++ b/src/lib/ABWStylesCollector.cpp
|
||||
@@ -167,28 +167,32 @@ void libabw::ABWStylesCollector::closeTable()
|
||||
|
||||
void libabw::ABWStylesCollector::openCell(const char *props)
|
||||
{
|
||||
- if (props)
|
||||
- parsePropString(props, m_ps->m_tableStates.top().m_currentCellProperties);
|
||||
- int currentRow(0);
|
||||
- if (!findInt(_findCellProperty("top-attach"), currentRow))
|
||||
- currentRow = m_ps->m_tableStates.top().m_currentTableRow + 1;
|
||||
- while (m_ps->m_tableStates.top().m_currentTableRow < currentRow)
|
||||
- m_ps->m_tableStates.top().m_currentTableRow++;
|
||||
-
|
||||
- if (!m_ps->m_tableStates.empty() && 0 == m_ps->m_tableStates.top().m_currentTableRow)
|
||||
+ if (!m_ps->m_tableStates.empty())
|
||||
{
|
||||
- int leftAttach(0);
|
||||
- int rightAttach(0);
|
||||
- if (findInt(_findCellProperty("left-attach"), leftAttach) && findInt(_findCellProperty("right-attach"), rightAttach))
|
||||
- m_ps->m_tableStates.top().m_currentTableWidth += rightAttach - leftAttach;
|
||||
- else
|
||||
- m_ps->m_tableStates.top().m_currentTableWidth++;
|
||||
+ if (props)
|
||||
+ parsePropString(props, m_ps->m_tableStates.top().m_currentCellProperties);
|
||||
+ int currentRow(0);
|
||||
+ if (!findInt(_findCellProperty("top-attach"), currentRow))
|
||||
+ currentRow = m_ps->m_tableStates.top().m_currentTableRow + 1;
|
||||
+ while (m_ps->m_tableStates.top().m_currentTableRow < currentRow)
|
||||
+ m_ps->m_tableStates.top().m_currentTableRow++;
|
||||
+
|
||||
+ if (0 == m_ps->m_tableStates.top().m_currentTableRow)
|
||||
+ {
|
||||
+ int leftAttach(0);
|
||||
+ int rightAttach(0);
|
||||
+ if (findInt(_findCellProperty("left-attach"), leftAttach) && findInt(_findCellProperty("right-attach"), rightAttach))
|
||||
+ m_ps->m_tableStates.top().m_currentTableWidth += rightAttach - leftAttach;
|
||||
+ else
|
||||
+ m_ps->m_tableStates.top().m_currentTableWidth++;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
void libabw::ABWStylesCollector::closeCell()
|
||||
{
|
||||
- m_ps->m_tableStates.top().m_currentCellProperties.clear();
|
||||
+ if (!m_ps->m_tableStates.empty())
|
||||
+ m_ps->m_tableStates.top().m_currentCellProperties.clear();
|
||||
}
|
||||
|
||||
std::string libabw::ABWStylesCollector::_findCellProperty(const char *name)
|
Loading…
Reference in a new issue