cwCommonImpl.h/cpp : Added #include <ccytpe>. Check for null label in labelToId()

This commit is contained in:
kevin 2023-07-25 20:22:44 -04:00
parent 7e6ab875c9
commit 39599e3e2e
2 changed files with 7 additions and 4 deletions

View File

@ -28,9 +28,11 @@ const char* cw::idToLabel( const idLabelPair_t* array, unsigned id, unsigned eol
unsigned cw::labelToId( const idLabelPair_t* array, const char* label, unsigned eolId )
{
const idLabelPair_t* p = array;
for(; p->id != eolId; ++p)
if( std::strcmp(label,p->label) == 0 )
return p->id;
if( label != nullptr )
for(; p->id != eolId; ++p)
if( std::strcmp(label,p->label) == 0 )
return p->id;
return eolId;
}

View File

@ -17,6 +17,7 @@
#include <atomic>
#include <cstdint>
#include <cmath>
#include <cctype>
#include <complex>
#include <type_traits>