Skip to content

Commit

Permalink
portal-impl: Protect against NULL impls
Browse files Browse the repository at this point in the history
find_portal_implementation_by_name() is nullable, so it's important to
deal with it properly.

Patch originally proposed by @swick.

Closes #1455
  • Loading branch information
GeorgesStavracas committed Oct 9, 2024
1 parent 59714e0 commit 9bf16ad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/portal-impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,12 @@ find_portal_implementation_iface (const PortalInterface *iface)

impl = find_portal_implementation_by_name (portal);

if (!impl)
{
g_info ("Requested backend %s does not exist. Skipping...", portal);
continue;
}

if (!portal_impl_supports_iface (impl, iface->dbus_name))
{
g_info ("Requested backend %s.portal does not support %s. Skipping...", impl->source, iface->dbus_name);
Expand Down Expand Up @@ -637,7 +643,7 @@ find_default_implementation_iface (const char *interface)

impl = find_portal_implementation_by_name (portal);

if (portal_impl_supports_iface (impl, interface))
if (impl && portal_impl_supports_iface (impl, interface))
return impl;
}
return NULL;
Expand Down

0 comments on commit 9bf16ad

Please sign in to comment.