Try to get SharedDrawable non-nullable

This commit is contained in:
khanhduytran0 2021-01-28 15:05:03 +07:00
parent 31b44a830e
commit 51fe37a0c5

View File

@ -47,7 +47,11 @@ import org.lwjgl.LWJGLException;
public final class SharedDrawable extends DrawableGL { public final class SharedDrawable extends DrawableGL {
public SharedDrawable(final Drawable drawable) throws LWJGLException { public SharedDrawable(final Drawable drawable) throws LWJGLException {
this.context = (ContextGL)((DrawableLWJGL)drawable).createSharedContext(); if (drawable != null) {
this.context = (ContextGL)((DrawableLWJGL)drawable).createSharedContext();
} else {
this.context = (ContextGL)((DrawableLWJGL)Display.getDrawable()).createSharedContext();
}
} }
public ContextGL createSharedContext() { public ContextGL createSharedContext() {