reverse_coverage icon indicating copy to clipboard operation
reverse_coverage copied to clipboard

`TypeError: nil can't be coerced into Integer`

Open bhb opened this issue 4 years ago • 0 comments

Apologies, I don't have a minimal repro for this bug, but in version 0.1.1, I occasionally get the error

TypeError: nil can't be coerced into Integer from this line:

https://github.com/nebulab/reverse_coverage/blob/df4ca35eab1048775e974adb33c0ecfa0d6488a1/lib/reverse_coverage/main.rb#L91

The issue is that values[1] can be nil in some cases.

I changed that line to values[0] == values[1] ? nil : (values[1].to_i - values[0]) and it avoids the crash, although I'm not sure if that causes incorrect reporting.

bhb avatar Feb 19 '21 17:02 bhb