Skip to content

Commit

Permalink
fix: encode strings (even empty strings) when stored
Browse files Browse the repository at this point in the history
This fixes a bug where `CallContext.store('')` would throw an error.
  • Loading branch information
chrisdickinson committed Jul 15, 2024
1 parent dfd14ae commit 892d59c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/call-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,14 @@ export class CallContext {

/** @hidden */
[STORE](input?: string | Uint8Array): number | null {
if (!input) {
return null;
}

if (typeof input === 'string') {
input = this.#encoder.encode(input);
}

if (!input) {
return null;
}

if (input instanceof Uint8Array) {
if (input.buffer.constructor === this.#arrayBufferType) {
// no action necessary, wrap it up in a block
Expand Down

0 comments on commit 892d59c

Please sign in to comment.