/* Allocate command context. This and its internals must be free'd
by the command routine receiving it. */
- ctx = silc_calloc(1, sizeof(*ctx));
+ ctx = silc_client_command_alloc();
ctx->client = app->client;
ctx->conn = app->conn;
ctx->command = cmd;
} else {
/* Normal message to a channel */
- if (len && app->conn->current_channel &&
+ if (len && app->conn && app->conn->current_channel &&
app->conn->current_channel->on_channel == TRUE) {
silc_print(app->client, "> %s", data);
silc_client_packet_send_to_channel(app->client,