Frank Kobzik has uploaded a new change for review.

Change subject: frontend: null checks
......................................................................

frontend: null checks

added null checks to ConsoleModelsCache and
MainTabBasicDetailsPresenterWidget

Change-Id: I770e0ec23d59643f37b5f8be93a7565c47a3d006
Signed-off-by: Frantisek Kobzik <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ConsoleModelsCache.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/basic/MainTabBasicDetailsPresenterWidget.java
2 files changed, 9 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/70/21870/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ConsoleModelsCache.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ConsoleModelsCache.java
index 042a8b6..22b8fa3b4 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ConsoleModelsCache.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ConsoleModelsCache.java
@@ -45,13 +45,15 @@
     public void updateCache(Iterable<VM> newItems) {
         Set<Guid> vmIds = new HashSet<Guid>();
 
-        for (VM vm : newItems) {
-            if (vmConsoles.containsKey(vm.getId())) {
-                vmConsoles.get(vm.getId()).setVm(vm); // only update vm
-            } else {
-                vmConsoles.put(vm.getId(), new VmConsolesImpl(vm, parentModel, 
consoleContext));
+        if (newItems != null) {
+            for (VM vm : newItems) {
+                if (vmConsoles.containsKey(vm.getId())) {
+                    vmConsoles.get(vm.getId()).setVm(vm); // only update vm
+                } else {
+                    vmConsoles.put(vm.getId(), new VmConsolesImpl(vm, 
parentModel, consoleContext));
+                }
+                vmIds.add(vm.getId());
             }
-            vmIds.add(vm.getId());
         }
 
         vmConsoles.keySet().retainAll(vmIds);
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/basic/MainTabBasicDetailsPresenterWidget.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/basic/MainTabBasicDetailsPresenterWidget.java
index b4fd3a9..b82f3e9 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/basic/MainTabBasicDetailsPresenterWidget.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/basic/MainTabBasicDetailsPresenterWidget.java
@@ -197,7 +197,7 @@
     }
 
     private boolean isEditConsoleEnabled(UserPortalItemModel item) {
-        return item.getVM() != null && item.getVM().isRunningOrPaused();
+        return item != null && item.getVM() != null && 
item.getVM().isRunningOrPaused();
     }
 
 }


-- 
To view, visit http://gerrit.ovirt.org/21870
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I770e0ec23d59643f37b5f8be93a7565c47a3d006
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Frank Kobzik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to