From de5fb361ad1bc520e7c670e57a4d1444045dc749 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 21 Oct 2020 00:24:38 +0100 Subject: [PATCH] Fix crash when saving order backups --- src/saveload/saveload.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 0ea8b66533..00f3e85900 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -704,8 +704,9 @@ static inline uint SlCalcConvMemLen(VarType conv) */ static inline byte SlCalcConvFileLen(VarType conv) { - static const byte conv_file_size[] = {1, 1, 2, 2, 4, 4, 8, 8, 2}; byte length = GB(conv, 0, 4); + if (length == SLE_FILE_VEHORDERID) return SlXvIsFeaturePresent(XSLFI_MORE_VEHICLE_ORDERS) ? 2 : 1; + static const byte conv_file_size[] = {1, 1, 2, 2, 4, 4, 8, 8, 2}; assert(length < lengthof(conv_file_size)); return conv_file_size[length]; }