Add null check in "Set item position history" metod