Check for the existence of the action index before testing the value

Make sure it exists before testing

Resolves #1457