Can't call #delete() with an invalid key #4

eric opened this Issue May 7, 2012 · 3 comments


None yet
2 participants

eric commented May 7, 2012

I just got a report of this: eric/metriks#13

It looks like the problem is that if you try to delete a key that wasn't found, it still tries to call #value on the result.


eric commented May 7, 2012

I actually got further on it. The problem is when the key is of a different type:

It looks like the problem is <=> returns nil if the types don't match, and there is no case for that.


nahi commented May 8, 2012

Ah, thanks for the investigation. We removed 'key.to_s' so <=> could return nil now.
I'm going to change trees to raise TypeError when <=> returns nil for both #insert and #delete.
Do you think it's OK for you?


eric commented May 8, 2012

Yeah, I think that makes sense. At least I'll be able to figure out
where my bug is.

nahi closed this in da512e6 May 8, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment