mirror of
https://github.com/swaywm/sway.git
synced 2024-11-27 18:31:28 +00:00
text_input: Check for allocation failure
This commit is contained in:
parent
266cd4515a
commit
48069097ea
|
@ -448,6 +448,11 @@ static void handle_im_new_popup_surface(struct wl_listener *listener,
|
||||||
struct sway_input_method_relay *relay = wl_container_of(listener, relay,
|
struct sway_input_method_relay *relay = wl_container_of(listener, relay,
|
||||||
input_method_new_popup_surface);
|
input_method_new_popup_surface);
|
||||||
struct sway_input_popup *popup = calloc(1, sizeof(*popup));
|
struct sway_input_popup *popup = calloc(1, sizeof(*popup));
|
||||||
|
if (!popup) {
|
||||||
|
sway_log(SWAY_ERROR, "Failed to allocate an input method popup");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
popup->relay = relay;
|
popup->relay = relay;
|
||||||
popup->popup_surface = data;
|
popup->popup_surface = data;
|
||||||
popup->popup_surface->data = popup;
|
popup->popup_surface->data = popup;
|
||||||
|
|
Loading…
Reference in a new issue