check that simulation is running before joining sim thread

This commit is contained in:
fros4943 2008-12-04 13:04:26 +00:00
parent dafd174e30
commit 3893969096

View file

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: Simulation.java,v 1.32 2008/12/04 12:44:02 fros4943 Exp $ * $Id: Simulation.java,v 1.33 2008/12/04 13:04:26 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -275,7 +275,9 @@ public class Simulation extends Observable implements Runnable {
/* Wait until simulation stops */ /* Wait until simulation stops */
if (Thread.currentThread() != thread) { if (Thread.currentThread() != thread) {
try { try {
if (thread != null) {
thread.join(); thread.join();
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
} }
} }