Moved the current category tagging inside the if-clause that checks that a product object exists in the context.