diff --git a/module/rdd-utility.js b/module/rdd-utility.js
index 42282e26..47910657 100644
--- a/module/rdd-utility.js
+++ b/module/rdd-utility.js
@@ -526,7 +526,7 @@ export class RdDUtility {
defenseMsg.content += "
Esquiver";
}
- defenseMsg.toSocket = (!game.user.isGM) ? true : false;
+ defenseMsg.toSocket = myTarget.hasPlayerOwner;
return defenseMsg;
}
@@ -543,12 +543,15 @@ export class RdDUtility {
}
} else if (sockmsg.msg == "msg_defense" ) {
let defenderActor = game.actors.get( sockmsg.data.defenderid );
- if ( (game.user.isGM && !defenderActor.isPC) || (defenderActor.isPC && game.user.character.id == defenderActor.id ) ) {
- console.log("User is pushing message...", game.user.name);
- sockmsg.data.whisper = [ game.user ];
- sockmsg.data.blind = true;
- sockmsg.data.rollMode = "blindroll";
- ChatMessage.create( sockmsg.data );
+ console.log("Defense message reçu : ", defenderActor.hasPlayerOwner, game.user.character.id, defenderActor.id);
+ if ( defenderActor ) {
+ if ( (game.user.isGM && !defenderActor.hasPlayerOwner) || (defenderActor.hasPlayerOwner && (game.user.character.id == defenderActor.id) ) ) {
+ console.log("User is pushing message...", game.user.name);
+ sockmsg.data.whisper = [ game.user ];
+ sockmsg.data.blind = true;
+ sockmsg.data.rollMode = "blindroll";
+ ChatMessage.create( sockmsg.data );
+ }
}
}
}
diff --git a/system.json b/system.json
index c7079f9b..1430fa74 100644
--- a/system.json
+++ b/system.json
@@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT",
- "version": "0.9.33",
+ "version": "0.9.34",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.6",
"templateVersion": 44,