int iMaxLogLength = documentContext.getItemValueInteger("numworkflowhistoryLength");
if (iMaxLogLength > 0) {
while (historyList.size() > iMaxLogLength)
historyList.remove(0);
}
<BUG>if (historyList != null) {</BUG>
documentContext.replaceItemValue("txtworkflowhistory", historyList);
<BUG>}</BUG>
documentContext.replaceItemValue("timworkflowlastaccess", new Date());
return documentContext;

int iMaxLogLength = documentContext.getItemValueInteger("numworkflowhistoryLength");
if (iMaxLogLength > 0) {
while (historyList.size() > iMaxLogLength)
historyList.remove(0);
}
documentContext.replaceItemValue("txtworkflowhistory", historyList);
documentContext.replaceItemValue("timworkflowlastaccess", new Date());
return documentContext;
