diff --git a/sway/config/output.c b/sway/config/output.c index 88514ac0d..aa4cf9460 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -27,8 +27,10 @@ int output_name_cmp(const void *item, const void *data) { void output_get_identifier(char *identifier, size_t len, struct sway_output *output) { struct wlr_output *wlr_output = output->wlr_output; - snprintf(identifier, len, "%s %s %s", wlr_output->make, wlr_output->model, - wlr_output->serial); + snprintf(identifier, len, "%s %s %s", + wlr_output->make ? wlr_output->make : "Unknown", + wlr_output->model ? wlr_output->model : "Unknown", + wlr_output->serial ? wlr_output->serial : "Unknown"); } const char *sway_output_scale_filter_to_string(enum scale_filter_mode scale_filter) { diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 06121d627..e682bc362 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -248,11 +248,11 @@ static void ipc_json_describe_output(struct sway_output *output, json_object_object_add(object, "primary", json_object_new_boolean(false)); json_object_object_add(object, "make", - json_object_new_string(wlr_output->make)); + json_object_new_string(wlr_output->make ? wlr_output->make : "Unknown")); json_object_object_add(object, "model", - json_object_new_string(wlr_output->model)); + json_object_new_string(wlr_output->model ? wlr_output->model : "Unknown")); json_object_object_add(object, "serial", - json_object_new_string(wlr_output->serial)); + json_object_new_string(wlr_output->serial ? wlr_output->serial : "Unknown")); json_object *modes_array = json_object_new_array(); struct wlr_output_mode *mode;