summaryrefslogtreecommitdiff
path: root/net/FlatBuffers
diff options
context:
space:
mode:
authormustiikhalil <mustii@mmk.one>2020-07-27 19:57:50 +0300
committerGitHub <noreply@github.com>2020-07-27 09:57:50 -0700
commitf1025b284735d184f4a22dfe999ad65bfe558096 (patch)
tree05c0555471fe83764ffffba370564c115fb3fb19 /net/FlatBuffers
parent5d052f4e55d28117c208898cbfd96dc7ea37678d (diff)
downloadflatbuffers-f1025b284735d184f4a22dfe999ad65bfe558096.tar.gz
flatbuffers-f1025b284735d184f4a22dfe999ad65bfe558096.tar.bz2
flatbuffers-f1025b284735d184f4a22dfe999ad65bfe558096.zip
[Feature] Checks for Nullable strings (#6050)
* Allows null strings in createString method c# * Adds nullable strings to JS and swift * Changes js checks * Fixes typo
Diffstat (limited to 'net/FlatBuffers')
-rw-r--r--net/FlatBuffers/FlatBufferBuilder.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/FlatBuffers/FlatBufferBuilder.cs b/net/FlatBuffers/FlatBufferBuilder.cs
index 27c16b36..195530a8 100644
--- a/net/FlatBuffers/FlatBufferBuilder.cs
+++ b/net/FlatBuffers/FlatBufferBuilder.cs
@@ -554,6 +554,10 @@ namespace FlatBuffers
/// </returns>
public StringOffset CreateString(string s)
{
+ if (s == null)
+ {
+ return new StringOffset(0);
+ }
NotNested();
AddByte(0);
var utf8StringLen = Encoding.UTF8.GetByteCount(s);
@@ -594,6 +598,11 @@ namespace FlatBuffers
/// </returns>
public StringOffset CreateSharedString(string s)
{
+ if (s == null)
+ {
+ return new StringOffset(0);
+ }
+
if (_sharedStringMap == null)
{
_sharedStringMap = new Dictionary<string, StringOffset>();