fixed error on empty array passed in
Merge pull request #3 from LDLN/hot_sam

fixed error on empty array passed in