Bugfix: handle no-element case when printing expression.

Without this fix, Expression::print() causes a segfault when dim is 0.