From 9662129c7c884697c61dc674461ad9475bf67729 Mon Sep 17 00:00:00 2001
From: Giacomo Sanchietti <giacomo.sanchietti@nethesis.it>
Date: Thu, 27 Jun 2024 09:09:57 +0200
Subject: [PATCH] objects: fix ip address retrieval

Make sure that if the object is invalide, the
function returns an empty IP list.

This fixes an issue with creation of port forward rules
not using objects.
---
 src/nethsec/objects/__init__.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/nethsec/objects/__init__.py b/src/nethsec/objects/__init__.py
index c654dac7..2ad68d7f 100644
--- a/src/nethsec/objects/__init__.py
+++ b/src/nethsec/objects/__init__.py
@@ -113,6 +113,8 @@ def get_object_ips(uci, database_id):
         a list of unique IP addresses from the object
     """
     ips = []
+    if not database_id:
+        return ips
 
     obj = get_object(uci, database_id)
     database, id = database_id.split('/')