ex_cmds2.c:fix for issue #1164

fix condition while iterating over all buffers

This fixes a bug introduced by PR #1024. This was reported in issue #1164.