Skip to content

Commit 9bf16ad

Browse files
committedOct 9, 2024·
portal-impl: Protect against NULL impls
find_portal_implementation_by_name() is nullable, so it's important to deal with it properly. Patch originally proposed by @swick. Closes #1455
1 parent 59714e0 commit 9bf16ad

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎src/portal-impl.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,12 @@ find_portal_implementation_iface (const PortalInterface *iface)
604604

605605
impl = find_portal_implementation_by_name (portal);
606606

607+
if (!impl)
608+
{
609+
g_info ("Requested backend %s does not exist. Skipping...", portal);
610+
continue;
611+
}
612+
607613
if (!portal_impl_supports_iface (impl, iface->dbus_name))
608614
{
609615
g_info ("Requested backend %s.portal does not support %s. Skipping...", impl->source, iface->dbus_name);
@@ -637,7 +643,7 @@ find_default_implementation_iface (const char *interface)
637643

638644
impl = find_portal_implementation_by_name (portal);
639645

640-
if (portal_impl_supports_iface (impl, interface))
646+
if (impl && portal_impl_supports_iface (impl, interface))
641647
return impl;
642648
}
643649
return NULL;

0 commit comments

Comments
 (0)
Please sign in to comment.