MySQL Continue Handler Problems inside a Function
Before  MySQL 5.6.3, if a statement that generates a warning or error causes a condition handler to be invoked, the handler may not clear the diagnostic area. This might lead to the appearance that the handler was not invoked.

I have explained this kind of behavior and the solution in this post:

Event Scheduler: No data - zero rows fetched, selected, or processed