mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-23 12:40:01 +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.
|
/// @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
|
/// @return Returns the offset in the buffer where the string starts
|
||||||
Offset<String> CreateSharedString(const String *str) {
|
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
|
/// @cond FLATBUFFERS_INTERNAL
|
||||||
|
|||||||
Reference in New Issue
Block a user