Make getActiveClient throw an error if disconnected

This commit is contained in:
Simon Ser 2021-06-03 10:13:24 +02:00
parent a4294975a2
commit 9067b5a168

View file

@ -4,7 +4,7 @@ import { SERVER_BUFFER, BufferType } from "./state.js";
function getActiveClient(app) { function getActiveClient(app) {
var buf = app.state.buffers.get(app.state.activeBuffer); var buf = app.state.buffers.get(app.state.activeBuffer);
if (!buf) { if (!buf) {
return null; throw new Error("Not connected to server");
} }
return app.clients.get(buf.network); return app.clients.get(buf.network);
} }