Skip to content

Commit

Permalink
close should be safe to double call
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Mar 20, 2024
1 parent b3aa634 commit ff10b2f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/org/mujoco/MuJoCoModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,11 @@ public long getTimestepMilliSeconds() {
}

public void close() {
connected = false;
MuJoCoLib.mj_deleteData(d);
MuJoCoLib.mj_deleteModel(m);
if(connected) {
connected = false;
MuJoCoLib.mj_deleteData(d);
MuJoCoLib.mj_deleteModel(m);
}
}

/**
Expand Down

0 comments on commit ff10b2f

Please sign in to comment.