Similar stuff happened to me when I spend my finance school fee believing my salary will be paid in two days time but was shocked after the salary was prosponed due to some reasons. The school fee was needed urgently and this put me into serious issues but thanks to my friends who bailed me out. This same issue has happened to us once or twice in our journey of life.
You cant really predict the outcome i mean this really happens to me everytime that you paid something and thinking that you'll get salary on that day but turns out not, so this assumption that you need to have like emergency funds , meaning if that day you will not get a salary you should have a money that can last you in a day or 2 just to be safe because if you dont have money on that day for sure you have nothing to eat.