Skip to content

Commit

Permalink
fix(core): fix content nullable error, close #47
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Apr 25, 2023
1 parent 34f6202 commit a4d5a39
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/session.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineProperty } from 'cosmokit'
import { defineProperty, isNullable } from 'cosmokit'
import { Context } from '.'
import { Bot } from './bot'
import { Universal } from './universal'
Expand Down Expand Up @@ -74,11 +74,11 @@ export class Session {
}

get content() {
return this.elements.join('')
return this.elements?.join('')
}

set content(value: string) {
this.elements = segment.parse(value)
this.elements = isNullable(value) ? value : segment.parse(value)
}

async transform(elements: segment[]): Promise<segment[]> {
Expand Down

0 comments on commit a4d5a39

Please sign in to comment.