Fix crashing issues when pressing UI buttons

This commit is contained in:
D1GQ committed 2026-06-25 15:40:55 -05:00
1 parent 88006b31f9
commit d36273e7a9
1 file changed
+33
@@ -0,0 +1,33 @@
using HarmonyLib;
namespace BetterAmongUs.Patches.Fixes;
// This fixes crashing issue when pressing UI buttons, W Innerslop!!!
// Fix by https://github.com/TouseefX
[HarmonyPatch]
internal static class PassiveButtonFixPatch
{
[HarmonyPatch(typeof(PassiveButton), nameof(PassiveButton.ReceiveClickDown))]
[HarmonyPrefix]
public static bool PassiveButton_ReceiveClickDown_Prefix(PassiveButton __instance)
{
if (__instance == null || __instance.Pointer == IntPtr.Zero)
{
return false;
}
return true;
}
[HarmonyPatch(typeof(PassiveButton), nameof(PassiveButton.ReceiveClickUp))]
[HarmonyPrefix]
public static bool PassiveButton_ReceiveClickUp_Prefix(PassiveButton __instance)
{
if (__instance == null || __instance.Pointer == IntPtr.Zero)
{
return false;
}
return true;
}
}