summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerjoystick.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerjoystick.cpp')
-rw-r--r--indra/newview/llviewerjoystick.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp
index b2516f3c71..e35cb26ce1 100644
--- a/indra/newview/llviewerjoystick.cpp
+++ b/indra/newview/llviewerjoystick.cpp
@@ -519,10 +519,13 @@ void LLViewerJoystick::initDevice(void * preffered_device /* LPDIRECTINPUTDEVICE
void LLViewerJoystick::terminate()
{
#if LIB_NDOF
-
- ndof_libcleanup();
- LL_INFOS("Joystick") << "Terminated connection with NDOF device." << LL_ENDL;
- mDriverState = JDS_UNINITIALIZED;
+ if (mNdofDev != NULL)
+ {
+ ndof_libcleanup(); // frees alocated memory in mNdofDev
+ mDriverState = JDS_UNINITIALIZED;
+ mNdofDev = NULL;
+ LL_INFOS("Joystick") << "Terminated connection with NDOF device." << LL_ENDL;
+ }
#endif
}