--- src/js/jsMacOSX.cxx.orig	2011-10-28 10:30:30.000000000 +0100
+++ src/js/jsMacOSX.cxx	2011-10-28 10:31:50.000000000 +0100
@@ -261,8 +261,11 @@
 
 void jsJoystick::close()
 {
-	if (os->hidDev != NULL)  (*(os->hidDev))->close(os->hidDev);
-	if (os) delete os;
+    if (os) {
+        if (os->hidDev)  (*(os->hidDev))->close(os->hidDev);
+        delete os;
+        os = NULL;
+    }
 }
 
 /** element enumerator function : pass NULL for top-level*/
