avoid out of bounds array access when windowless

-[NSArray objectAtIndex:0] will throw an NSRangeException if the array is empty.
Merge pull request #480 from pizthewiz/range-exception-osx

avoid out of bounds access when windowless