The "Nice" language shows that it's pretty easy to statically avoid this: http://nice.sourceforge.net/safety.html
The sad fact is that the Java and .NET base class libraries were designed before (1) generics and (2) a generic "Nullable" (aka "Option") type were available. Anyone designing a statically typed environment today should certainly include both and design a compiler to enforce their usage and safety.