coavins / mhrise-coavins-dps

A detailed DPS meter for Monster Hunter Rise (PC)
GNU General Public License v3.0
24 stars 11 forks source link

Crit% causes table to stop updating after a monster is mounted #49

Closed coavins closed 2 years ago

coavins commented 2 years ago

Describe the bug The crit % column causes the display to stop updating after a monster is mounted. Probably a divide by zero or something like that is happening.

Steps to Reproduce For example:

  1. Use crit% column
  2. Mount a monster
  3. See the table stop updating

Expected behavior Table should never stop updating, it makes it look like the mod has frozen.

duydao commented 2 years ago

It also happens when using the weak% column, maybee it's be related:

[15616] sol: runtime error: ...nterRise\reframework\autorun/mhrise-coavins-dps\draw.lua:185: attempt to perform arithmetic on a nil value (field 'pctDnCrit')
[15616] stack traceback:
[15616]  ...nterRise\reframework\autorun/mhrise-coavins-dps\draw.lua:185: in function 'mhrise-coavins-dps.draw.drawReportItemColumn'
[15616]  ...nterRise\reframework\autorun/mhrise-coavins-dps\draw.lua:324: in function 'mhrise-coavins-dps.draw.drawReportItem'
[15616]  ...nterRise\reframework\autorun/mhrise-coavins-dps\draw.lua:501: in function 'mhrise-coavins-dps.draw.drawReport'
[15616]  ...nterRise\reframework\autorun/mhrise-coavins-dps\draw.lua:629: in function 'mhrise-coavins-dps.draw.dpsDraw'
duydao commented 2 years ago

It looks like this happens to me when enabling the "Not shown" row in combination with the Follow Me mod. The hits of the followers are not counted, which could lead to a division by zero:

https://github.com/coavins/mhrise-coavins-dps/blob/5d161329bfe2e16d45ca902f57ec7d37ae2936bd/src/autorun/mhrise-coavins-dps/report.lua#L447-L448

Somehow, the value assigned is nil (instead of indef) and the draw.lua cant format the number:

https://github.com/coavins/mhrise-coavins-dps/blob/5d161329bfe2e16d45ca902f57ec7d37ae2936bd/src/autorun/mhrise-coavins-dps/draw.lua#L182-L185

coavins commented 2 years ago

Thanks for the help, I've fixed this issue from a couple different angles. This specific nan operation on draw.lua line 183 & 185 is fixed, and I also added a pcall so that any future problems of this kind should not prevent the entire table from updating.