Skip to content

Commit bc549cc

Browse files
committed
show toast if there's no code to run
1 parent ea54542 commit bc549cc

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/context/SimulationContext.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ export function SimulationContextProvider({ children }: Props) {
156156
position: "bottom-left",
157157
})
158158
} else if (r.kind == "result") {
159+
if (r.data.length == 0) {
160+
toast.info("No code to run!", {
161+
description: "Write some code, and then start the simulation.",
162+
position: "bottom-left",
163+
})
164+
return
165+
}
166+
159167
setError(undefined)
160168
setPrevPc(undefined)
161169

src/lib/assembler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ export function assemble(
329329
code,
330330
index: 0,
331331
line: 1,
332-
reachedEnd: false,
332+
reachedEnd: code.length == 0,
333333
}
334334

335335
const data: number[] = []

0 commit comments

Comments
 (0)