Do not pass a null pointer to unlink()

Found by clang static analyzer.

Change-Id: I8f15ae1a8e6afb91eafa6cee1d1b21e3539af6c1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>