Skip to content

Commit

Permalink
fix issue with example mod
Browse files Browse the repository at this point in the history
  • Loading branch information
XtraCube committed Sep 14, 2024
1 parent 2f7b069 commit faed84d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MiraAPI.Example/Buttons/MeetingButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class MeetingButton : CustomActionButton

public override bool Enabled(RoleBehaviour? role)
{
return PlayerControl.LocalPlayer.HasModifier<CaptainModifier>();
return PlayerControl.LocalPlayer != null && PlayerControl.LocalPlayer.HasModifier<CaptainModifier>();
}

protected override void OnClick()
Expand Down
5 changes: 3 additions & 2 deletions MiraAPI/Utilities/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,12 @@ public static bool IsCustom(this OptionBehaviour optionBehaviour)
}

component = player.GetComponent<ModifierComponent>();
if (component)
if (component == null)
{
ModifierComponents[player] = component;
return null;
}

ModifierComponents[player] = component;
return component;
}

Expand Down

0 comments on commit faed84d

Please sign in to comment.