Move `strlen()` out of this check instead of calling it twice?