With the assertion added this error condition here will never be reached anyway. I would do one or another (have the assertion or return -1). Having the -1 return in the code can be misleading to whoever uses this method.