[PATCH v6 4/6] fix potential logic error