Add null check before clearing ArrayController