Fix a segfault. Kudos to aradulovic and jverillard.

Signed-off-by: David Navarro <david.navarro@intel.com>