mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Some changes to logged data and a NPE prevention.
This commit is contained in:
parent
3e4c9dc645
commit
41ba4c9540
3 changed files with 19 additions and 14 deletions
|
@ -25,7 +25,6 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.server;
|
package mage.server;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
@ -160,9 +159,9 @@ public class ChatSession {
|
||||||
User user = UserManager.getInstance().getUser(userId);
|
User user = UserManager.getInstance().getUser(userId);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
user.fireCallback(new ClientCallback("chatMessage", chatId, new ChatMessage(username, msg, time, color, messageType, soundToPlay)));
|
user.fireCallback(new ClientCallback("chatMessage", chatId, new ChatMessage(username, msg, time, color, messageType, soundToPlay)));
|
||||||
}
|
} else {
|
||||||
else {
|
// Happens when a user post to a chat while other users left chat at nearly the same time
|
||||||
logger.error("User not found but connected to chat - userId: " + userId + " chatId: " + chatId);
|
logger.trace("User not found but connected to chat - userId: " + userId + " chatId: " + chatId);
|
||||||
clientsToRemove.add(userId);
|
clientsToRemove.add(userId);
|
||||||
remove = true;
|
remove = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1159,6 +1159,9 @@ public abstract class AbilityImpl implements Ability {
|
||||||
public MageObject getSourceObject(Game game) {
|
public MageObject getSourceObject(Game game) {
|
||||||
if (sourceObject == null) {
|
if (sourceObject == null) {
|
||||||
setSourceObject(null, game);
|
setSourceObject(null, game);
|
||||||
|
if (sourceObject == null) {
|
||||||
|
logger.warn("Source object could not be retrieved: " + this.getRule());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return sourceObject;
|
return sourceObject;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,8 +106,11 @@ public class ManaPoolItem implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getSourceId() {
|
public UUID getSourceId() {
|
||||||
|
if (sourceObject != null) {
|
||||||
return sourceObject.getId();
|
return sourceObject.getId();
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public UUID getOriginalId() {
|
public UUID getOriginalId() {
|
||||||
return originalId;
|
return originalId;
|
||||||
|
|
Loading…
Reference in a new issue