Add missing error check

Noticed that an error check for this function was missing, so I added it.


Docker-DCO-1.1-Signed-off-by: Nathan LeClaire <nathan.leclaire@docker.com> (github: nathanleclaire)