Skip to content

Commit

Permalink
Prevent NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Nov 1, 2024
1 parent a2c3329 commit 2f63308
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/org/spin/processor/service/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
************************************************************************************/
package org.spin.processor.service;

import java.util.Optional;

import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MProcess;
import org.compiere.model.MRole;
Expand Down Expand Up @@ -78,7 +80,7 @@ private static RunProcessorResponse.Builder runProcess(int processId, String par
if(process == null || process.getAD_Process_ID() <= 0) {
throw new AdempiereException("@AD_Process_ID@ @NotFound@");
}
if(!MRole.getDefault().getProcessAccess(process.getAD_Process_ID())) {
if(!Optional.ofNullable(MRole.getDefault().getProcessAccess(process.getAD_Process_ID())).orElse(false)) {
if (process.isReport()) {
throw new AdempiereException("@AccessCannotReport@");
}
Expand Down

0 comments on commit 2f63308

Please sign in to comment.