Core/Misc: Fix some static analysis issues

Add some asserts and additional NULL checks as sanity checks.
Core/Misc: Fix typo in f47962f6707bb53a3241d23257a5bbd1b2679f87
Merge branch 'master' of git://github.com/TrinityCore/TrinityCore