diff --git a/api/src/main/java/org/openmrs/api/context/UserContext.java b/api/src/main/java/org/openmrs/api/context/UserContext.java index 983f262f2fe..fd47a5f3cdd 100755 --- a/api/src/main/java/org/openmrs/api/context/UserContext.java +++ b/api/src/main/java/org/openmrs/api/context/UserContext.java @@ -238,6 +238,11 @@ public void logout() { * @param privilege to give to users */ public void addProxyPrivilege(String privilege) { + + if (privilege == null) { + throw new IllegalArgumentException("UserContext.addProxyPrivilege does not accept null privileges"); + } + log.debug("Adding proxy privilege: {}", privilege); proxies.add(privilege);