Add input parameter validation for some functions
Add NULL checks
Add NULL checks
Merge branch 'fix-issue-5' into release-1.2

Conflicts:
	src/output.c
Merge remote-tracking branch 'origin/fix-issue-6' into release-1.2

Conflicts:
	src/image.c
	src/output.c