mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-12-22 17:59:47 +01:00
prevent segfaults on no toplevel proto available
This commit is contained in:
parent
3c850a0336
commit
8a4e83da96
2 changed files with 5 additions and 0 deletions
|
@ -526,6 +526,7 @@ int xdpw_screencast_init(struct xdpw_state *state) {
|
|||
|
||||
state->screencast = (struct xdpw_screencast_context) { 0 };
|
||||
state->screencast.state = state;
|
||||
state->screencast.hyprland_toplevel_manager = NULL;
|
||||
|
||||
int err;
|
||||
err = xdpw_pwr_context_create(state);
|
||||
|
|
|
@ -601,6 +601,10 @@ struct xdpw_share xdpw_wlr_chooser(struct xdpw_screencast_context *ctx) {
|
|||
struct xdpw_share res2 = {out, coords[0], coords[1], coords[2], coords[3]};
|
||||
return res2;
|
||||
} else if (strncmp(result, "window:", 7) == 0) {
|
||||
if (ctx->hyprland_toplevel_manager == NULL) {
|
||||
return res;
|
||||
}
|
||||
|
||||
char *display_name = malloc(strlen(result) - 7);
|
||||
strncpy(display_name, result + 7, strlen(result) - 8);
|
||||
display_name[strlen(result) - 8] = 0;
|
||||
|
|
Loading…
Reference in a new issue