Test with defined, not length, to avoid warnings.

@melmothX reported that this is spamming the logs with uninitialized variable
warnings.