It's just defensive programming.  For this change, the to_s is probably not relevant.  However, if someone makes use of is_numeric?() in the future and passes a nil, it will not throw an exception, but rather return false.