From 5975ea6c74d5b663a8ef0304786e4b330a1f6108 Mon Sep 17 00:00:00 2001 From: Brian Hinz Date: Tue, 11 Dec 2012 22:12:35 +0000 Subject: Fixes regression introduced by r5016 (exception produced when connecting to 8bpp server) git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5017 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- java/com/tigervnc/rfb/PixelBuffer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'java') diff --git a/java/com/tigervnc/rfb/PixelBuffer.java b/java/com/tigervnc/rfb/PixelBuffer.java index 4627318d..d7380b78 100644 --- a/java/com/tigervnc/rfb/PixelBuffer.java +++ b/java/com/tigervnc/rfb/PixelBuffer.java @@ -41,8 +41,11 @@ public class PixelBuffer { case 6: // Fall-through to depth 8 case 8: - if (cm != null && cm instanceof IndexColorModel) + if (!pf.trueColour) { + if (cm == null) + cm = new IndexColorModel(8, 256, new byte[256], new byte[256], new byte[256]); break; + } int rmask = pf.redMax << pf.redShift; int gmask = pf.greenMax << pf.greenShift; int bmask = pf.blueMax << pf.blueShift; -- cgit v1.2.3