aboutsummaryrefslogtreecommitdiff
path: root/src/repl-connection.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-07-01 18:35:54 +0200
committerThomas White <taw@physics.org>2021-07-01 18:35:54 +0200
commite2c1e172b28fed82059b3c73b5b53e591b68a599 (patch)
treed52cb121662f2a0d5a065d160db4082e03467568 /src/repl-connection.c
parent37abbb3484045ec99210620d45c56f84a991bc9f (diff)
Fixture display: Fix shutdown logic
Diffstat (limited to 'src/repl-connection.c')
-rw-r--r--src/repl-connection.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/repl-connection.c b/src/repl-connection.c
index 663c649..2e3201f 100644
--- a/src/repl-connection.c
+++ b/src/repl-connection.c
@@ -212,10 +212,18 @@ ReplConnection *repl_connection_new(const char *socket,
int repl_send(ReplConnection *repl, const char *line)
{
GError *error = NULL;
- GOutputStream *out = g_io_stream_get_output_stream(G_IO_STREAM(repl->conn));
+ GOutputStream *out;
+
+ if ( repl->conn == NULL ) {
+ fprintf(stderr, "No REPL to send to!\n");
+ return 1;
+ }
+
if ( repl->verbose ) {
printf("%p send: %s\n", repl, line);
}
+
+ out = g_io_stream_get_output_stream(G_IO_STREAM(repl->conn));
if ( g_output_stream_write(out, line, strlen(line), NULL, &error) == -1 ) {
fprintf(stderr, "Couldn't send: %s\n", error->message);
return 1;