Fix potential crash
This commit is contained in:
parent
82145168ec
commit
733e004d44
|
@ -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())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user