Fix potential crash

This commit is contained in:
Maxime Coste 2015-07-22 18:38:44 +01:00
parent 82145168ec
commit 733e004d44

View File

@ -272,6 +272,8 @@ CharCoord Window::display_position(ByteCoord coord) const
ByteCoord Window::buffer_coord(CharCoord coord) const ByteCoord Window::buffer_coord(CharCoord coord) const
{ {
if (m_display_buffer.lines().empty())
return {0,0};
if (coord <= 0_line) if (coord <= 0_line)
coord = {0,0}; coord = {0,0};
if ((int)coord.line >= m_display_buffer.lines().size()) if ((int)coord.line >= m_display_buffer.lines().size())