From ed25692d9399b537282cff6586efd9612f30f3d3 Mon Sep 17 00:00:00 2001 From: Walter Korman Date: Wed, 22 May 2002 21:47:14 +0000 Subject: [PATCH] Deal gracefully with moving to a non-existent location. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1385 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../crowd/chat/client/ChatDirector.java | 6 ++++-- .../crowd/client/OccupantDirector.java | 16 +++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/java/com/threerings/crowd/chat/client/ChatDirector.java b/src/java/com/threerings/crowd/chat/client/ChatDirector.java index d3d293d01..7d8d3cc13 100644 --- a/src/java/com/threerings/crowd/chat/client/ChatDirector.java +++ b/src/java/com/threerings/crowd/chat/client/ChatDirector.java @@ -1,5 +1,5 @@ // -// $Id: ChatDirector.java,v 1.20 2002/04/30 17:27:30 mdb Exp $ +// $Id: ChatDirector.java,v 1.21 2002/05/22 21:44:54 shaper Exp $ package com.threerings.crowd.chat; @@ -186,7 +186,9 @@ public class ChatDirector // listen to the new object _place = place; - _place.addListener(this); + if (_place != null) { + _place.addListener(this); + } } // documentation inherited diff --git a/src/java/com/threerings/crowd/client/OccupantDirector.java b/src/java/com/threerings/crowd/client/OccupantDirector.java index 2c0d5fb82..951d102be 100644 --- a/src/java/com/threerings/crowd/client/OccupantDirector.java +++ b/src/java/com/threerings/crowd/client/OccupantDirector.java @@ -1,5 +1,5 @@ // -// $Id: OccupantDirector.java,v 1.1 2002/04/15 14:38:45 shaper Exp $ +// $Id: OccupantDirector.java,v 1.2 2002/05/22 21:47:14 shaper Exp $ package com.threerings.crowd.client; @@ -118,13 +118,15 @@ public class OccupantDirector // listen to the new one _place = place; - _place.addListener(this); + if (_place != null) { + _place.addListener(this); - // cache the occupant info for the occupants in this room - Iterator iter = _place.occupantInfo.entries(); - while (iter.hasNext()) { - OccupantInfo info = (OccupantInfo)iter.next(); - _ocache.put(info.getBodyOid(), info); + // cache the occupant info for the occupants in this room + Iterator iter = _place.occupantInfo.entries(); + while (iter.hasNext()) { + OccupantInfo info = (OccupantInfo)iter.next(); + _ocache.put(info.getBodyOid(), info); + } } }