The Messenger of Allah ﷺ said: If any one of you has pain in his abdomen, but is doubtful whether or not anything has issued from him, be should not leave the mosque unless he hears a sound or perceives a smell. (Using translation from Muslim 362)
قَالَ رَسُولُ اللهِ ﷺ إِذَا وَجَدَ أَحَدُكُمْ فِي بَطْنِهِ شَيْئًا فَأَشْكَلَ عَلَيْهِ أَخَرَجَ مِنْهُ شَيْءٌ أَمْ لَا فَلَا يَخْرُجَنَّ مِنَ الْمَسْجِدِ حَتَّى يَسْمَعَ صَوْتًا أَوْ يَجِدَ رِيحًا