Skip to content

Commit

Permalink
don't crash when result is null
Browse files Browse the repository at this point in the history
fixes #45
  • Loading branch information
jaked committed Jul 22, 2024
1 parent 2432780 commit af640ff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/server/src/executeCell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ function rewriteStack(stack: undefined | string): undefined | string {
function mimeTaggedResultOf(result: any) {
if (result === undefined) {
return undefined;
} else if (result === null) {
return { mime: "text/x-javascript", data: "null" };
} else if (result instanceof Error) {
const obj = {
name: result.name,
Expand Down Expand Up @@ -90,7 +92,7 @@ function makeCellOutput(result: any) {
const mimeTaggedResult = mimeTaggedResultOf(result);

const items: CellOutputItem[] = [];
if (mimeTaggedResult !== undefined) {
if (mimeTaggedResult) {
items.push({
data: [...Buffer.from(mimeTaggedResult.data, "utf8").values()],
mime: mimeTaggedResult.mime,
Expand Down

0 comments on commit af640ff

Please sign in to comment.