Assigning a return value which is potentially None to a tuple and
catching TypeError is pretty ugly. Rewrite the code to explicitly check
the value for clarity.
(Bitbake rev: f4ebb27616ac2df27c29a6052b1526a4c48db607)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>