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

@ -1,5 +1,5 @@
# Mod properties
mod_version=1.89.0
mod_version=1.89.1
# Minecraft properties
mc_version=1.12.2

View File

@ -170,7 +170,7 @@ private static void renderTerminal( ClientMonitor monitor, float xMargin, float
}
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 );

View File

@ -1,3 +1,7 @@
# New features in CC: Tweaked 1.89.1
* Fix crashes when rendering monitors of varying sizes.
# New features in CC: Tweaked 1.89.0
* Compress monitor data, reducing network traffic by a significant amount.

View File

@ -1,10 +1,5 @@
New features in CC: Tweaked 1.89.0
New features in CC: Tweaked 1.89.1
* Compress monitor data, reducing network traffic by a significant amount.
* Allow limiting the bandwidth monitor updates use.
* Several optimisations to monitor rendering (@Lignum)
And several bug fixes:
* Fix settings.load failing on defined settings.
* Fix crashes when rendering monitors of varying sizes.
Type "help changelog" to see the full version history.