소스 검색

Fix issue if no static routes are defined

Neil Beadle 5 년 전
부모
커밋
08c8e9ad1c
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 5
      vycontrol/static/views.py

+ 6 - 5
vycontrol/static/views.py

@@ -23,11 +23,12 @@ def static_list(request):
     is_superuser = perms.get_is_superuser(request.user)
 
     static_list = []
-    for s in static_dict['route']:
-        static_list.append({
-            'route': s,
-            'nexthop': static_dict['route'][s]['next-hop'],
-        })
+    if static_dict :
+        for s in static_dict['route']:
+            static_list.append({
+                'route': s,
+                'nexthop': static_dict['route'][s]['next-hop'],
+            })
 
     template = loader.get_template('static/list.html')
     context = {