diff --git a/netbox_branching/utilities.py b/netbox_branching/utilities.py index 044c567..7ffd7c3 100644 --- a/netbox_branching/utilities.py +++ b/netbox_branching/utilities.py @@ -258,6 +258,6 @@ def ActiveBranchContextManager(request): """ Activate a branch if indicated by the request. """ - if branch := get_active_branch(request): + if request and (branch := get_active_branch(request)): return activate_branch(branch) return nullcontext()