microoptimisation: no need to compute string length to test emptiness

Change-Id: If5093bca0e16e0f631c8cd1a7f4dde8bbf7da077