Author: christian.bauer(a)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) {
Show replies by date