Blah blah fix non-windows builds.
Fixed some unused variable warnings/errors when not compiling with assertions enabled. (eg 'release' configuration). Also snagged a nullcheck from upstream.