Error in rule?

Hello
What is the error in this rule??

Rule "control timer"
when                                                                      
  Item string_rfidreader_cardid received update                           
then                                                                      
    try{                                                                  
        if (globarvar_timer_resetcardinfo === null)                       
        {                                                                 
            globarvar_timer_resetcardinfo = createTimer(now.plusSeconds(20),[ |
                string_rfidreader_cardid.postUpdate("-")                  
                string_rfidreader_cardinfo1.postUpdate("-")               
                string_rfidreader_cardinfo2.postUpdate("-")               
                globarvar_timer_resetcardinfo = null   // reset the timer 
                logInfo("control timer globarvar_timer_resetcardinfo", "reset")
            ])                                                            
        }                                                                 
        else                                                              
        {                                                                 
        globarvar_timer_resetcardinfo.reschedule(now.plusSeconds(20))     
        logInfo("control timer globarvar_timer_resetcardinfo", "timer reset")
        }                                                                 
    }                                                                     
    catch(Throwable T)                                                    
    {                                                                     
        logError("Error", "Some bad stuff happened in \"control timer\"")
        string_rfidreader_cardid.postUpdate("-")                          
        string_rfidreader_cardinfo1.postUpdate("-")                       
        string_rfidreader_cardinfo2.postUpdate("-")                       
        globarvar_timer_resetcardinfo = null                              
    }                                                                     
    finally                                                               
    {
}

Error is

[INFO ] [ timer globarvar_timer_resetcardinfo] - reset
 [ERROR] [eclipse.smarthome.model.script.Error] - Some bad stuff happened in "control timer globarvar_timer_resetcardinfo": java.lang.NullPointerException: cannot invoke method public abstract boolean org.eclipse.smarthome.model.script.actions.Timer.reschedule(org.joda.time.base.AbstractInstant) on null

Do I nee a space between "[(space)| " or no space [| ???

Did you define the Timer var globally?

// on top of any rule in the file
var Timer globarvar_timer_resetcardinfo = null

Yes I did…sorry missed it here

There can be a TOC-TOU error here. It’s possible that the rule runs, see’s that the timer isn’t null, in the background the timer executes and sets the Timer to null, and then the rule tries to reschedule it. Dose the error happen every time the Rule runs or only sometimes? Add logging to see more information about when the Timer is executing compared to the Rule running.

@milo
I mean this in the most respectful way but… this thread has the world’s worst title ever