find first non-null element in an array