WordPress query_posts with multiple tax_query

The below query only works if $_POST[‘product_cat’] and $_POST[‘sub_category’] return something. How do I make this work if either one of these are empty?

In the end I will have 6 different optional taxonomies so I can’t really have a separate query for every combination.

        query_posts(array(
            'post_type' => 'product',
            'post_status' => 'publish',
            'tax_query' => array(
                'relation' => 'AND',
                array(
                    'taxonomy' => 'product_cat',
                    'terms' => $_POST['product_cat'],
                ),
                array(
                    'taxonomy' => 'sub_category',
                    // 'field' => 'slug',
                    'terms' => $_POST['sub_category'],
                ),
                ...
            )
        ));