PVS-StudioWarnings

PVS-Studio warning V595 for FlightGear

Nov 11th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. bool FGAIShip::initFlightPlan() {
  2.   ....
  3.   prev = fp->getPreviousWaypoint();
  4.   ....
  5.   setHeading(getCourse(prev->getLatitude(),
  6.                        prev->getLongitude(),
  7.                        curr->getLatitude(),
  8.                        curr->getLongitude()));
  9.   ....
  10.   if (prev)
  11.     init = true;
  12.   ....
  13. }
  14.  
  15. This suspicious code was found in FlightGear project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V595 The 'prev' pointer was utilized before it was verified against nullptr. Check lines: 858, 868. aiship.cxx 858
  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