From ea4fed18c4dc99dca4e5a01001e6e2cdfe557405 Mon Sep 17 00:00:00 2001 From: Brian Matzon Date: Mon, 12 Jan 2004 17:15:41 +0000 Subject: [PATCH] assert that Window has been created --- src/native/win32/org_lwjgl_input_Controller.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/native/win32/org_lwjgl_input_Controller.cpp b/src/native/win32/org_lwjgl_input_Controller.cpp index 4b3bde5d..1ab0420c 100644 --- a/src/native/win32/org_lwjgl_input_Controller.cpp +++ b/src/native/win32/org_lwjgl_input_Controller.cpp @@ -116,6 +116,13 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_initIDs(JNIEnv * env, jcl * Called when the Controller instance is to be created */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jclass clazz) { + + // assert that window has been created + if(hwnd == NULL) { + throwException(env, "Please create the window before initializing input devices\n"); + return; + } + // Create the DirectInput object. HRESULT hr; hr = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &cDI, NULL);