[ticket/12140] Avoid endless loop in diff creation

http://tracker.phpbb.com/browse/PHPBB3-12140