I commonly ran into 2 tyoes of malfunctions:
1) Slide is out of battery-opened, due to FTE/FTF/double.
My immediate action is drop the mag, then rack the slide. Usually dropping the mag is enough to fix the issue.
2). Slide in battery-closed. Pulled the trigger and heard a click. I'd TRB as Shrek instructed.
This usually caused by slide failure to lock back on empty mag, OR a catastrophic failure of case splitting/bulging.
My main take away, if slide is open malfunction (same with AR), I'll immediately drop the mag.