Skip to content

Commit

Permalink
Anticipate Document#uuid becoming nullable in V13
Browse files Browse the repository at this point in the history
  • Loading branch information
stwlam committed Jan 29, 2025
1 parent 727823a commit a6e8f71
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/module/actor/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ class ActorPF2e<TParent extends TokenDocumentPF2e | null = TokenDocumentPF2e | n
return;
}
// Set after data model is initialized so that `this.id` will be defined (and `this.uuid` will be complete)
this.signature ??= UUIDv5(this.uuid, "e9fa1461-0edc-4791-826e-08633f1c6ef7"); // magic number as namespace
this.signature ??= UUIDv5(this.uuid ?? "", "e9fa1461-0edc-4791-826e-08633f1c6ef7"); // magic number as namespace
this.initialized = true;
super.prepareData();

Expand Down
3 changes: 1 addition & 2 deletions src/module/system/action-macros/crafting/craft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import { SelectItemDialog } from "./select-item.ts";

export async function craft(options: CraftActionOptions): Promise<void> {
// resolve item
const item =
options.item ?? (options.uuid ? await fromUuid(options.uuid) : await SelectItemDialog.getItem("craft"));
const item = options.item ?? (await (options.uuid ? fromUuid(options.uuid) : SelectItemDialog.getItem("craft")));

// ensure item is a valid crafting target
if (!item) {
Expand Down
3 changes: 1 addition & 2 deletions src/module/system/action-macros/crafting/repair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { SelectItemDialog } from "./select-item.ts";

async function repair(options: RepairActionOptions): Promise<void> {
// resolve item
const item =
options.item ?? (options.uuid ? await fromUuid(options.uuid) : await SelectItemDialog.getItem("repair"));
const item = options.item ?? (await (options.uuid ? fromUuid(options.uuid) : SelectItemDialog.getItem("repair")));

// ensure specified item is a valid crafting target
if (!(item instanceof PhysicalItemPF2e)) {
Expand Down

0 comments on commit a6e8f71

Please sign in to comment.