Fix a wrong condition
Merge pull request #6876 from chinhodado/patch-3

Fix a wrong condition in buffer resizing