diff --git a/cwText.cpp b/cwText.cpp index fc305f1..eebaf8e 100644 --- a/cwText.cpp +++ b/cwText.cpp @@ -149,15 +149,19 @@ unsigned cw::toText( char* buf, unsigned bufN, double v ) unsigned cw::toText( char* buf, unsigned bufN, const char* v ) { - assert( v != nullptr ); - - unsigned sn = strlen(v) + 1; - - // bufN must be greater than the length of v[] - if( sn >= bufN ) + if( v == nullptr ) + { + cwLogError(kInvalidArgRC,"The source string in a call to 'toText()' was null."); return 0; + } + + unsigned i; + for(i=0; i