[seam-commits] Seam SVN: r7235 - trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Jan 25 10:45:10 EST 2008


Author: christian.bauer at jboss.com
Date: 2008-01-25 10:45:10 -0500 (Fri, 25 Jan 2008)
New Revision: 7235

Modified:
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java
Log:
Fix NPE

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java	2008-01-25 14:21:26 UTC (rev 7234)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java	2008-01-25 15:45:10 UTC (rev 7235)
@@ -65,10 +65,11 @@
     }
 
     public long findRatingPoints(Long userId) {
-        return (Long)entityManager
+        Object ratingPoints = entityManager
                 .createQuery("select sum(n.rating) from WikiNode n where n.createdBy.id = :userId")
                 .setParameter("userId", userId)
                 .getSingleResult();
+        return ratingPoints != null ? (Long)ratingPoints : 0;
     }
 
     public void resetNodeCreatorToAdmin(User user) {




More information about the seam-commits mailing list