Changeset 701:43444784a0ba in make_builder


Ignore:
Timestamp:
18.02.2019 17:12:58 (4 weeks ago)
Author:
Tobias Föhst <tobias.foehst@…>
Branch:
default
Phase:
public
Tags:
tip
Message:

Bugfix: throws exception for invalid enum values even in continuous enumerations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • enum_strings_builder/enum_strings.h

    r633 r701  
    140140      } 
    141141    } 
    142     throw std::runtime_error("Could not find enum string for value '" + std::to_string(static_cast<uint64_t>(value)) + "'!"); 
    143142  } 
    144   assert(static_cast<size_t>(value) < enum_strings.size); 
    145   return enum_strings.strings[static_cast<size_t>(format)][static_cast<size_t>(value)]; 
     143  if (static_cast<size_t>(value) < enum_strings.size) 
     144  { 
     145    return enum_strings.strings[static_cast<size_t>(format)][static_cast<size_t>(value)]; 
     146  } 
     147  throw std::runtime_error("Could not find enum string for value '" + std::to_string(static_cast<uint64_t>(value)) + "'!"); 
    146148} 
    147149 
Note: See TracChangeset for help on using the changeset viewer.