Throw an exception if  is empty

Signed-off-by: crynobone <crynobone@gmail.com>