Kaydet (Commit) 5500c51e authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

harden access to OUString[0]

Change-Id: Ibc2997f9974b8f6d561db0632642060ab95b80f0
üst 18fa868f
...@@ -2807,7 +2807,7 @@ void VclBuilder::applyPackingProperty(Window *pCurrent, ...@@ -2807,7 +2807,7 @@ void VclBuilder::applyPackingProperty(Window *pCurrent,
if (sKey == "expand") if (sKey == "expand")
{ {
bool bTrue = (sValue[0] == 't' || sValue[0] == 'T' || sValue[0] == '1'); bool bTrue = (!sValue.isEmpty() && (sValue[0] == 't' || sValue[0] == 'T' || sValue[0] == '1'));
if (pToolBoxParent) if (pToolBoxParent)
pToolBoxParent->SetItemExpand(m_pParserState->m_nLastToolbarId, bTrue); pToolBoxParent->SetItemExpand(m_pParserState->m_nLastToolbarId, bTrue);
else else
...@@ -2820,12 +2820,12 @@ void VclBuilder::applyPackingProperty(Window *pCurrent, ...@@ -2820,12 +2820,12 @@ void VclBuilder::applyPackingProperty(Window *pCurrent,
if (sKey == "fill") if (sKey == "fill")
{ {
bool bTrue = (sValue[0] == 't' || sValue[0] == 'T' || sValue[0] == '1'); bool bTrue = (!sValue.isEmpty() && (sValue[0] == 't' || sValue[0] == 'T' || sValue[0] == '1'));
pCurrent->set_fill(bTrue); pCurrent->set_fill(bTrue);
} }
else if (sKey == "pack-type") else if (sKey == "pack-type")
{ {
VclPackType ePackType = (sValue[0] == 'e' || sValue[0] == 'E') ? VCL_PACK_END : VCL_PACK_START; VclPackType ePackType = (!sValue.isEmpty() && (sValue[0] == 'e' || sValue[0] == 'E')) ? VCL_PACK_END : VCL_PACK_START;
pCurrent->set_pack_type(ePackType); pCurrent->set_pack_type(ePackType);
} }
else if (sKey == "left-attach") else if (sKey == "left-attach")
......
...@@ -1231,7 +1231,7 @@ void VclGrid::setAllocation(const Size& rAllocation) ...@@ -1231,7 +1231,7 @@ void VclGrid::setAllocation(const Size& rAllocation)
bool toBool(const OString &rValue) bool toBool(const OString &rValue)
{ {
return (rValue[0] == 't' || rValue[0] == 'T' || rValue[0] == '1'); return (!rValue.isEmpty() && (rValue[0] == 't' || rValue[0] == 'T' || rValue[0] == '1'));
} }
bool VclGrid::set_property(const OString &rKey, const OString &rValue) bool VclGrid::set_property(const OString &rKey, const OString &rValue)
......
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