Closed junaruga closed 4 years ago
Do you have an example that causes this in the real library? I can see that this could happen, but it would only be a case where there’s a hunk that has neither remove
or insert
operations. An actual example allows me to write useful tests and decide the correct sort of behaviour.
Hi @halostatue . Thanks for checking the code. I do not have the real library. This was detected by a static code analysis tool Possibly it is Coverity Scan. https://scan.coverity.com/
Seeing below lines. https://github.com/halostatue/diff-lcs/blob/v1.3/lib/diff/lcs/hunk.rb#L42-L45
When both a1 and b1 are nil or both a2 and b2 are nil,
NameError
is raised unintentionally. Maybe we can add a code to check it in advance?