[hack] Fix potential out of bounds issue
[hack] Fix potential out of bounds issue

Summary:
While investigating T44384921 I found a lot of errors in this particular calculation.

The code appears to be expecting "Not_found" as the exception when the position cannot be found, but instead it's throwing an index out of bounds error.

Let's convert the code to throw a consistent error.

Reviewed By: 2BitSalute

Differential Revision: D15433935

fbshipit-source-id: f4381362147583c2545bfae27e19dab9e33694df

nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow