diff options
-rw-r--r-- | src/level.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/level.cpp b/src/level.cpp index 5fa4619..bf94d95 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -130,6 +130,12 @@ void Level::save() const return; } + if (m_width > 255 || m_height > 255) { + std::cerr << "Failed to save level!\n" + << "Level save format does not allow widths or heights greater than 255\n"; + return; + } + outputStream.write((char*)&m_width, 1); outputStream.write((char*)&m_height, 1); outputStream.write((char*)m_tiles, m_width * m_height); |