mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 12:05:50 +00:00
[C++] Fixed crash when copying table with empty shared strings (#7477)
This commit is contained in:
@@ -579,7 +579,7 @@ class FlatBufferBuilder {
|
||||
/// @param[in] str A const pointer to a `String` struct to add to the buffer.
|
||||
/// @return Returns the offset in the buffer where the string starts
|
||||
Offset<String> CreateSharedString(const String *str) {
|
||||
return CreateSharedString(str->c_str(), str->size());
|
||||
return str ? CreateSharedString(str->c_str(), str->size()) : 0;
|
||||
}
|
||||
|
||||
/// @cond FLATBUFFERS_INTERNAL
|
||||
|
||||
Reference in New Issue
Block a user