PVS-StudioWarnings

PVS-Studio warning V596 for MTASA

Nov 13th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. class CEGUIEXPORT InvalidRequestException : public Exception
  2. {
  3.   ....
  4. };
  5.  
  6. ListHeaderSegment*
  7. FalagardListHeader::createNewSegment(const String& name) const
  8. {
  9.   // make sure this has been set
  10.   if (d_segmentWidgetType.empty())
  11.   {
  12.     InvalidRequestException(
  13.       "FalagardListHeader::createNewSegment - "
  14.       "Segment widget type has not been set!");
  15.   }
  16.  
  17.   return ....;
  18. }
  19.  
  20. Most likely this is what should be written here: throw InvalidRequestException(....);
  21.  
  22. This suspicious code was found in MTASA project by PVS-Studio static code analyzer.
  23. Warning message is:
  24. V596 The object was created but it is not being used. The 'throw' keyword could be missing: throw InvalidRequestException(FOO); fallistheader.cpp 74
  25.  
  26. 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