Have you ever had a "good" day where you have eaten really well, kept a perfect NC diary with green ticks all round and good food choices... and then watched in horror as it all goes terribly wrong when you give into a sudden craving for something (fatty, sugary, salty) and pile on the calories? Me too.
Try using this 10 minute rule. It doesn't make it easy or fun, but it does make it more possible for me to resist a craving. I have noticed it is easier to do when I am working on my list of advantages of losing weight regularly because then they are in the front of my mind when I need them.
If the strength of craving has stayed the same: that's great. You've resisted for 10 minutes already, so you can do another ten minutes: you know you can, because you already have!
If the strength of the craving has gone down: that's fantastic. You've resisted a higher level craving for 10 minutes, you can certainly resist this lower level one for 10 minutes.
If the strength of the craving has gone up: be honest... how did you spend the 10 minutes? Were you thinking about either (1) how lovely the food would be or (2) how deprived / sorry for yourself you feel that you can't eat it? Go back and start again: but make it easy for yourself this time and follow one of the strategies above.
Remember you always have a choice: short term loss of a craved food/drink versus long term loss of weight? No contest really!