Fix crash on type conversion error

Fix for issue #1

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>