ENH: Fix Cppcheck possible inefficient checking for emptiness warning

Change-Id: I49d0bd3ca1845266e0ce8563aa8891181aef728b