The World Federation One Stop Fiqh

Ruling 746

If a person doubts during the ʿishāʾ prayer whether he has performed the maghrib prayer or not, he must complete the prayer with the intention of the ʿishāʾ prayer and after that perform the maghrib prayer. However, if the time is so little that after completing the prayer the time for prayers ends and there is not enough time remaining to perform even one rakʿah, it is not necessary to make up the maghrib prayer.