In addition to an assert, a 'nonnull' attribute on compilers that support it seems like a good idea.
If you use the nonnull attribute, the assertion will be optimized away.