windows: prevent use ptr before it was checked