mIRC checks for the failure of dialog creation, however if there is a cascade of allocation failures across many functions, it can sometimes be difficult to predict what will happen.
In order to display text in a window, such as an error message, mIRC needs to allocate memory for the string, string context, display context, bitmap handles, and so on. So any attempt to display an error message would very likely fail, if Windows has run out of resources. Pre-allocating all of these in anticipation of an error would be difficult. In general, once Windows has reached a low resource state, it is difficult to guarantee reliable behaviour.
I will try to reproduce this issue to see if I can prevent $input() itself crashing in a low resources state, however there will be many other side-effects in this situation, even if mIRC does not crash.