In the Quran Allah says :
مَّنِ ٱهْتَدَىٰ فَإِنَّمَا يَهْتَدِى لِنَفْسِهِۦ ۖ وَمَن ضَلَّ فَإِنَّمَا يَضِلُّ عَلَيْهَا ۚ وَلَا تَزِرُ وَازِرَةٌ وِزْرَ أُخْرَىٰ ۗ وَمَا كُنَّا مُعَذِّبِينَ حَتَّىٰ نَبْعَثَ رَسُولًا
Whoever chooses to be guided, it is only for their own good. And whoever chooses to stray, it is only to their own loss. No soul burdened with sin will bear the burden of another. And We would never punish ˹a people˺ until We have sent a messenger ˹to warn them˺. https://quran.com/17/15
From this verse we understand that non-muslims who have never heard about the message of Islam will not go to hell (here, the messenger is any muslim because every true muslim can send the message of Islam).
From this I can ask the question : if a Muslim knows that someone (a friend for example) has never heard the message of Islam and he doesn’t want to tell him about Islam because he is scared his friend is going to hell if he refuses, so he tries to not tell him about Islam (or hide the truth), is he committing a sin ?