1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2026-04-17 04:21:23 +00:00

Fix crashes when rendering monitors of varying sizes

When calling .flip(), we limit the size of the buffer. However, this
limit is not reset when writing the next time, which means we get
out-of-bounds errors, even if the buffer is /technically/ big enough.

Clearing the buffer before drawing (rather than just resetting the
position) is enough to fix this.

Fixes #476 (and closes #477, which is a duplicate)
This commit is contained in:
SquidDev
2020-06-21 12:03:24 +01:00
parent c0f3ca81fb
commit 2a8efb3fd5
4 changed files with 8 additions and 9 deletions

View File

@@ -170,7 +170,7 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
}
ByteBuffer monitorBuffer = tboContents;
monitorBuffer.position( 0 );
monitorBuffer.clear();
for( int y = 0; y < height; y++ )
{
TextBuffer text = terminal.getLine( y ), textColour = terminal.getTextColourLine( y ), background = terminal.getBackgroundColourLine( y );