diff --git a/net/FlatBuffers/FlatBufferBuilder.cs b/net/FlatBuffers/FlatBufferBuilder.cs index 3932f4bc318..af0e896eb9b 100644 --- a/net/FlatBuffers/FlatBufferBuilder.cs +++ b/net/FlatBuffers/FlatBufferBuilder.cs @@ -438,8 +438,7 @@ public void AddOffset(int off) if (off > Offset) throw new ArgumentException(); - if (off != 0) - off = Offset - off + sizeof(int); + off = Offset - off + sizeof(int); PutInt(off); } diff --git a/net/FlatBuffers/Table.cs b/net/FlatBuffers/Table.cs index d6d9d09fb4c..348d4c97d9b 100644 --- a/net/FlatBuffers/Table.cs +++ b/net/FlatBuffers/Table.cs @@ -65,11 +65,7 @@ public static int __indirect(int offset, ByteBuffer bb) // Create a .NET String from UTF-8 data stored inside the flatbuffer. public string __string(int offset) { - int stringOffset = bb.GetInt(offset); - if (stringOffset == 0) - return null; - - offset += stringOffset; + offset += bb.GetInt(offset); var len = bb.GetInt(offset); var startPos = offset + sizeof(int); return bb.GetStringUTF8(startPos, len);