Skip to content

Commit fd1ecab

Browse files
jcelerierclaude
andcommitted
webmidi: read the right EM_ASM argument when closing an input
stop_stream() passes one argument and read it as $1, so closing a Web MIDI input threw a TypeError out of the destructor and aborted the program. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SCvayD61okH7PATstw4whi
1 parent 00452d2 commit fd1ecab

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎include/libremidi/backends/emscripten/midi_access.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,10 @@ class midi_access_emscripten
303303
return;
304304

305305
const auto& id = m_current_inputs[port_index].id;
306-
EM_ASM(const id = UTF8ToString($1);
306+
EM_ASM(const id = UTF8ToString($0);
307307

308308
let input = globalThis.__libreMidi_access.inputs.get(id);
309-
input.onmidimessage = undefined;, id.c_str());
309+
if (input) input.onmidimessage = null;, id.c_str());
310310
}
311311

312312
std::vector<observer_emscripten*> m_observers;

0 commit comments

Comments
 (0)