Fix segfault in variableIsUsedInScope() - loop variable not check against NULL