t_time <- c()
length(t_time) #0
t_time[0] #NULL
t_time[length(t_time)] #NULL
t_time[length(t_time)] < 0 #logical(0)
if(TRUE){cat('foo')} # 'foo'
if(logical(0)){cat('bar')} # argument is of length zero
A conditional like if or while needs a logical vector of length 1 to operate on. Basically, it needs a TRUE or a FALSE, and logical(0) is neither of those.