Advertisement
PVS-StudioWarnings

PVS-Studio warning V595 for TrinityCore

Nov 20th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. bool OnCheck(Player* player, Unit* /*target*/)
  2. {
  3.   bool checkArea =
  4.     player->GetAreaId() == AREA_ARGENT_TOURNAMENT_FIELDS ||
  5.     player->GetAreaId() == AREA_RING_OF_ASPIRANTS ||
  6.     player->GetAreaId() == AREA_RING_OF_ARGENT_VALIANTS ||
  7.     player->GetAreaId() == AREA_RING_OF_ALLIANCE_VALIANTS ||
  8.     player->GetAreaId() == AREA_RING_OF_HORDE_VALIANTS ||
  9.     player->GetAreaId() == AREA_RING_OF_CHAMPIONS;
  10.  
  11.   return player && checkArea && player->duel
  12.     && player->duel->isMounted;
  13. }
  14.  
  15. This suspicious code was found in TrinityCore project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V595 The 'player' pointer was utilized before it was verified against nullptr. Check lines: 310, 312. scripts achievement_scripts.cpp 310
  18.  
  19. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement