Bug Fix

Fixed a bug causing a crash when given an empty array.