Skip to content

Fix assert when clicking "Auto Detect" for a POP server

David Faure requested to merge work/dfaure/fix_crash_in_servertest into release/21.08

commit 85b2d540 changed response.chop(2) into response.chopped(2) but the two methods behave differently if the string has less than 2 characters: chop(2) makes the string empty, while chopped(2) asserts ("The behavior is undefined if len is negative or greater than size().") Not blaming anyone, I would have made the same mistake, this is a pretty tricky inconsistency in Qt.

See ServerTestPrivate::slotTlsDone() for the call with an empty string as argument.

My fix makes it very explicit that the string can be empty, for future robustness.

Merge request reports