summaryrefslogtreecommitdiffstats
path: root/src/bind/javabind.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bind/javabind.cpp')
-rw-r--r--src/bind/javabind.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bind/javabind.cpp b/src/bind/javabind.cpp
index cb8c778b1..f7022584f 100644
--- a/src/bind/javabind.cpp
+++ b/src/bind/javabind.cpp
@@ -927,8 +927,14 @@ bool JavaBinderyImpl::loadJVM()
int versionMinor = (vers ) & 0xffff;
msg("Loaded JVM version %d.%d", versionMajor, versionMinor);
- if (!setupGateway())
+ if (!setupGateway()) {
+ // set jvm = NULL, otherwise, this method will return true when called for the second time while the gateway might not have been created!
+ jvm->DestroyJavaVM();
+ jvm = NULL;
+ env = NULL;
+ err("Java bindings: setupGateway() failed");
return false;
+ }
return true;
}