diff --git a/src/display/utils.cc b/src/display/utils.cc index aaa1b070..7382939c 100644 --- a/src/display/utils.cc +++ b/src/display/utils.cc @@ -224,10 +224,20 @@ print_download_percentage_done(char* first, char* last, core::Download* d) { char* print_client_version(char* first, char* last, const torrent::ClientInfo& clientInfo) { - return print_buffer(first, last, "%s %hhu.%hhu.%hhu.%hhu", - clientInfo.short_description(), - clientInfo.version()[0], clientInfo.version()[1], - clientInfo.version()[2], clientInfo.version()[3]); + switch (torrent::ClientInfo::version_size(clientInfo.type())) { + case 4: + return print_buffer(first, last, "%s %hhu.%hhu.%hhu.%hhu", + clientInfo.short_description(), + clientInfo.version()[0], clientInfo.version()[1], + clientInfo.version()[2], clientInfo.version()[3]); + case 3: + return print_buffer(first, last, "%s %hhu.%hhu.%hhu", + clientInfo.short_description(), + clientInfo.version()[0], clientInfo.version()[1], + clientInfo.version()[2]); + default: + return print_buffer(first, last, "%s", clientInfo.short_description()); + } } char* diff --git a/src/display/window_peer_list.cc b/src/display/window_peer_list.cc index 7805e379..dd29471d 100644 --- a/src/display/window_peer_list.cc +++ b/src/display/window_peer_list.cc @@ -42,6 +42,7 @@ #include #include #include +#include #include "core/download.h" #include "rak/algorithm.h"