diff --git a/include/osmium/builder/osm_object_builder.hpp b/include/osmium/builder/osm_object_builder.hpp index c3228ca7..afa70894 100644 --- a/include/osmium/builder/osm_object_builder.hpp +++ b/include/osmium/builder/osm_object_builder.hpp @@ -470,7 +470,7 @@ namespace osmium { * @pre @code strlen(user) < 2^16 - 1 @endcode */ TDerived& set_user(const char* user) { - const auto len = std::strlen(user); + const auto len = (user == nullptr) ? 0 : std::strlen(user); assert(len < std::numeric_limits::max()); return set_user(user, static_cast(len)); }