HearthSim / HSTracker

A deck tracker and deck manager for Hearthstone on macOS
https://hsreplay.net/downloads/
MIT License
1.19k stars 177 forks source link

fix: fix getCardChoices causes crash in some caese #1350

Closed flytam closed 1 month ago

flytam commented 1 month ago

On the M1 MacBook Pro, HSTracker encountered a crash frenquently. This is a rather terrible experience!

After local code debugging, seems that it was found that the exception is thrown by the Hearthstone's mirror?.getCardChoices

image

This doesn't happen every time the call is made, but only under certain circumstances. By adding an Objective-C bridging method to catch the exception, everything runs normally in Hearthstone.

I have also tried a few matches with the fixed code, and there were no crashes. HSTracker is running perfectly.

I'm not sure if this is the correct fix, but it works for me, and this fix won't cause any breaking changes.

Closes: #1349

fmoraes74 commented 1 month ago

Thanks for the PR. I will investigate the actual cause of the crash before deciding on the best way to fix it. In any case, do you have a CLA in place already? If not, @beheh can assist you before your PR can be merged.

flytam commented 1 month ago

sry I dont have a CLA in place already, but I am willing to finish it if this PR can be merged