diff options
author | Ashod Nakashian <ashodnakashian@yahoo.com> | 2015-01-09 11:08:58 -0500 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-01-21 16:38:23 +0000 |
commit | 4fcde4fe8ea5d4521a59e19291e393835144d7d9 (patch) | |
tree | 4bf19fce27cf803ea7db54a4b69caabc0f08dc14 /sw/inc/ndhints.hxx | |
parent | 01fb1701c8a59dd023604492a117ea1a6cffcee9 (diff) |
Hint assertions and sanity checks added.
Change-Id: I83bf8866c8855b3266703eca62010d28388c5a07
Reviewed-on: https://gerrit.libreoffice.org/13880
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/inc/ndhints.hxx')
-rw-r--r-- | sw/inc/ndhints.hxx | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx index 4bfbd1fc3da0..1202b7b62a5f 100644 --- a/sw/inc/ndhints.hxx +++ b/sw/inc/ndhints.hxx @@ -103,13 +103,25 @@ public: SwTxtAttr * Cut( const size_t nPosInStart ); inline const SwTxtAttr * GetStart( const size_t nPos ) const - { return m_HintStarts[nPos]; } + { + assert(nPos < m_HintStarts.size()); + return m_HintStarts[nPos]; + } inline const SwTxtAttr * GetEnd( const size_t nPos ) const - { return m_HintEnds [nPos]; } + { + assert(nPos < m_HintEnds.size()); + return m_HintEnds[nPos]; + } inline SwTxtAttr * GetStart( const size_t nPos ) - { return m_HintStarts[nPos]; } + { + assert(nPos < m_HintStarts.size()); + return m_HintStarts[nPos]; + } inline SwTxtAttr * GetEnd( const size_t nPos ) - { return m_HintEnds [nPos]; } + { + assert(nPos < m_HintStarts.size()); + return m_HintEnds[nPos]; + } inline size_t GetEndCount() const { return m_HintEnds.size(); } inline size_t GetStartCount() const { return m_HintStarts.size(); } @@ -122,8 +134,8 @@ public: inline SwTxtAttr * GetTextHint( const size_t nIdx ) { return GetStart(nIdx); } inline const SwTxtAttr * operator[]( const size_t nIdx ) const - { return m_HintStarts[nIdx]; } - inline size_t Count() const { return m_HintStarts.size(); } + { return GetStart(nIdx); } + inline size_t Count() const { return GetStartCount(); } #ifdef DBG_UTIL bool Check(bool) const; |