I sometimes get very painful muscle cramps at night, and one of the main triggers is a sudden rush of cold air. As long as both legs stay under the warm blankets, nothing happens. But if one of my legs gets exposed to cold air, I'll get calf muscle cramps. There's really not much I can do until the spasms stop. but sometimes my wife will hold my ankle and foot at an angle so my foot won't seize up.
I've heard that eating foods high in potassium or magnesium, like bananas, will help prevent some leg cramps. I've also found that sports creams with heat will provide muscle cramp relief. In my experience, ice can sometimes trigger another spasm. Massage works better, but it can be very painful at first. Sometimes a nonprofessional masseuse can accidentally touch the wrong spot and trigger another spasm, too.