diff --git a/include/relation.cpp b/include/relation.cpp index a76841393..1733636cc 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -2451,12 +2451,18 @@ void TFieldref::write(const char* val, TRectype& rec) const buffer = rec.get(_name); if (_to <= _from) ((TFieldref*)this)->_to = rec.length(_name); - buffer.overwrite(val, _from, _to - _from); - rec.put(_name, buffer); + if (val && *val) + { + buffer.overwrite(val, _from, _to - _from); + rec.put(_name, buffer); + } } else { - rec.put(_name, val); + if (val && *val) + rec.put(_name, val); + else + rec.zero(_name); } } diff --git a/include/strings.cpp b/include/strings.cpp index a4e9a056a..3f8079076 100755 --- a/include/strings.cpp +++ b/include/strings.cpp @@ -975,7 +975,8 @@ TString& TString::overwrite( // // @xref { - if (lung == 0) lung=strlen(s); + if (lung == 0 && s != NULL) + lung=strlen(s); if (s || lung) { const int l = len();