Fix: protection sur actions sans acteur/propriété
Cas rencontré une fois, un jet de chance d'un autre joueur, pouvait être tenté. Cas plus étrange, un jet de chance alors que le jet sauvegardé n'avait pas d'actorId
This commit is contained in:
+3
-3
@@ -233,16 +233,16 @@ export class Misc {
|
||||
if (Misc.isOwnerPlayer(document)) {
|
||||
return await action(document)
|
||||
} else {
|
||||
return await orElse(document)
|
||||
return await orElse(document ?? {name: '<aucune sélection>'})
|
||||
}
|
||||
}
|
||||
|
||||
static isOwnerPlayer(document) {
|
||||
return document.testUserPermission && document.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)
|
||||
return document && document.testUserPermission && document.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)
|
||||
}
|
||||
|
||||
static isFirstOwnerPlayer(document) {
|
||||
if (!document.testUserPermission) {
|
||||
if (!document?.testUserPermission) {
|
||||
return false
|
||||
}
|
||||
return game.users.find(u => document.testUserPermission(u, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)) == game.user
|
||||
|
||||
Reference in New Issue
Block a user