Silence a number of static analyzer warnings with assertions and such.

No functionality change.