Add check for empty result set var

Signed-off-by: Atanas Kerezov <kerezov.atanas@gmail.com>