Public abstract boolean Problem

Hello,
I have a problem with a rule definition

when the PIR recive a state change, it trigger these rule:

// Imports
import org.eclipse.smarthome.core.library.types.*
import org.eclipse.smarthome.core.persistence.*
import org.eclipse.smarthome.model.script.actions.*
import org.eclipse.smarthome.core.types.*
import org.eclipse.smarthome.core.items.*
import org.joda.time.*
import java.util.regex.Matcher
import java.util.regex.Pattern
import java.util.List

// Global Variables
var Timer LIFX_Timer_1 = null


rule "PIR_Soggiorno"
when
    Item PIR1_soggiorno changed
    or
    Item PIR2_soggiorno changed
then
	if (PIR1_soggiorno.state == ON || PIR2_soggiorno.state == ON) {
	  if (LIFX_Timer_1 == null) {  
	  	if ((now.isAfter(now.withTimeAtStartOfDay.plusHours(21)) || now.isBefore(now.withTimeAtStartOfDay.plusHours(7))) && LIFX1_Int_Soggiorno_Accendi.state == OFF && Luminosita_Int_Soggiorno.state < 10) {
	    sendCommand(LIFX1_Int_Soggiorno_Dimmer, 25)
	      LIFX_Timer_1 = createTimer(now.plusSeconds(30)) [|
	        LIFX_Timer_1.cancel
	        LIFX_Timer_1 = null
	        sendCommand(LIFX1_Int_Soggiorno_Accendi, OFF)
	      ]
	    } 
	  }
	}
  	else {
    	LIFX_Timer_1.reschedule(now.plusSeconds(30))
  	}
end

But on the logs file i have these error every time the PIR send a state change

[ERROR] [.script.engine.ScriptExecutionThread] - Rule 'PIR_Soggiorno': cannot invoke method public abstract boolean org.eclipse.smarthome.model.script.actions.Timer.reschedule(org.joda.time.base.AbstractInstant) on null

Can some one help me ?
I’m confused because the rule works

Looks like you got your {} pairs messed up.
The “else” statement “belongs” to the first if, not the third as you’d like.
so everytime “(PIR1_soggiorno.state == ON || PIR2_soggiorno.state == ON)” is true, your else statement is executed and tries to reinitialise a timer which is null.
Check your rule in designer, it should show you how to move around the else part.
HTH,
-OLI