diff --git a/ts/builder.ts b/ts/builder.ts index 9e7a67e7a..a8c2d1ee6 100644 --- a/ts/builder.ts +++ b/ts/builder.ts @@ -522,8 +522,11 @@ export class Builder { * @param s The string to encode * @return The offset in the buffer where the encoded string starts */ - createString(s: string | Uint8Array): Offset { - if (!s) { return 0 } + createString(s: string | Uint8Array | null | undefined): Offset { + if (s === null || s === undefined) { + return 0; + } + let utf8: string | Uint8Array | number[]; if (s instanceof Uint8Array) { utf8 = s;