gustafn
committed
on 30 Oct 13
- make function more robust against invalid input