There was a sister who was praying and she saw her grandson about to do something that would be harmful to him. She didn’t know what to do so she spoke to her daughter-in-law who was praying beside her. She knows that she’s not allowed to talk in prayer but in not knowing what to do it caused her to speak. Is her prayer invalidated and does she need to pray again?
Shaikh Ibn Baz said that if a person talked during the prayer subconsciously (he forgot it is not allowed) or if he was ignorant of this ruling then this action does not affect his prayer and he should not repeat the prayer.
In your case, you did not know what you should do so the ruling applies. In any emergency cases you are allowed to just leave the prayer and attend to the urgent matter. Also, it is allowed to wave as a signal or to clap.