diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-09-11 19:00:14 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-09-12 01:45:30 +0200 |
commit | 5500c51e9bddcf3bb4356ac3e69f4df1043df6c9 (patch) | |
tree | c45da2bb1474937302e98aceca6c7a0f1d6b2136 | |
parent | 18fa868f1424c9f859181dac4b5212ed7cb7dd0f (diff) |
harden access to OUString[0]
Change-Id: Ibc2997f9974b8f6d561db0632642060ab95b80f0
-rw-r--r-- | vcl/source/window/builder.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 8db06521a5c2..8a367132d517 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2807,7 +2807,7 @@ void VclBuilder::applyPackingProperty(Window *pCurrent, 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) pToolBoxParent->SetItemExpand(m_pParserState->m_nLastToolbarId, bTrue); else @@ -2820,12 +2820,12 @@ void VclBuilder::applyPackingProperty(Window *pCurrent, 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); } 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); } else if (sKey == "left-attach") diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index fb9903456b32..d38c56bf86c8 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1231,7 +1231,7 @@ void VclGrid::setAllocation(const Size& rAllocation) 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) |