Fix potential stack overflow in onCreateOptionsMenu