Core/Misc: Fix some static analysis issues

Fix some static analysis issues about:
- uninitialized values, most of which are false positives, always initialized before being accessed
- unchecked return values
- dead code never executed
- bad formatting leading to wrong behavior

Please ensure EventMap is never used with event id set to 0 or those events will never execute.
DB/SAI: Fix startup error

By untaught, closes #11587
Core/Spells: Fixed crash happening when a spell script set target to NULL in OnObjectTargetSelect hook for spells using nearby target selection
Merge pull request #1 from TrinityCore/master

Merge pull request #1 from TrinityCore/master