That is because get_option
will return an empty array if there are no sticky posts and the query will default to everything.
$sticky = get_option('sticky_posts');
if (!empty($sticky)) {
$args['post__in'] = $sticky;
$qry = new WP_Query(array('post__in' => $sticky));
if ($qry->have_posts()) :
while ($qry->have_posts()) : $qry->the_post();
echo $post->post_title;
endwhile;
endif;
}
And please don’t use query_posts
.