From 72d3556428cd68013cb604a708f27d3de0f60855 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 17:19:23 +0200 Subject: fix for bug 1391374. apparently, libnrtype drastically misses unit tests. Fixed bugs: - https://launchpad.net/bugs/1391374 (bzr r14127) --- src/libnrtype/Layout-TNG-OutIter.cpp | 4 ++-- src/libnrtype/Layout-TNG.h | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/libnrtype') diff --git a/src/libnrtype/Layout-TNG-OutIter.cpp b/src/libnrtype/Layout-TNG-OutIter.cpp index c9c318960..707897f50 100644 --- a/src/libnrtype/Layout-TNG-OutIter.cpp +++ b/src/libnrtype/Layout-TNG-OutIter.cpp @@ -788,12 +788,12 @@ bool Layout::iterator::prevLineCursor(int n) { if (!_cursor_moving_vertically) beginCursorUpDown(); - unsigned line_index; + int line_index; if (_char_index == _parent_layout->_characters.size()) line_index = _parent_layout->_lines.size() - 1; else line_index = _parent_layout->_characters[_char_index].chunk(_parent_layout).in_line; - if (line_index == 0) + if (line_index <= 0) return false; // nowhere to go else n = MIN (n, static_cast(line_index)); diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h index e91c32ebe..26db1fad9 100644 --- a/src/libnrtype/Layout-TNG.h +++ b/src/libnrtype/Layout-TNG.h @@ -701,7 +701,11 @@ private: /** The overall block-progression of the whole flow. */ inline Direction _blockProgression() const - {return static_cast(_input_stream.front())->styleGetBlockProgression();} + { + if(!_input_stream.empty()) + return static_cast(_input_stream.front())->styleGetBlockProgression(); + return TOP_TO_BOTTOM; + } /** so that LEFT_TO_RIGHT == RIGHT_TO_LEFT but != TOP_TO_BOTTOM */ static bool _directions_are_orthogonal(Direction d1, Direction d2); -- cgit v1.2.3