Commit 476ad038987b41e27920578741eef2098ac7306e

Authored by Matti Virkkunen
1 parent 9b7b0197

Fix crash when receiving a message of an unknown type (#1)

libpurple/line.thrift
... ... @@ -17,8 +17,21 @@ enum ContentType {
17 17 IMAGE = 1;
18 18 VIDEO = 2;
19 19 AUDIO = 3;
  20 + HTML = 4;
  21 + PDF = 5;
  22 + CALL = 6;
20 23 STICKER = 7;
  24 + PRESENCE = 8;
  25 + GIFT = 9;
  26 + GROUPBOARD = 10;
  27 + APPLINK = 11;
  28 + LINK = 12;
  29 + CONTACT = 13;
  30 + FILE = 14;
21 31 LOCATION = 15;
  32 + POSTNOTIFICATION = 16;
  33 + RICH = 17;
  34 + CHATEVENT = 18;
22 35 }
23 36  
24 37 enum ErrorCode {
... ...
libpurple/purpleline_write.cpp
... ... @@ -235,9 +235,12 @@ void PurpleLine::write_message(line::Message &msg, bool replay) {
235 235 // TODO: other content types
236 236  
237 237 default:
238   - text = "<em>[Not implemented: ";
239   - text += line::_ContentType_VALUES_TO_NAMES.at(msg.contentType);
240   - text += " message]</em>";
  238 + text = "<em>[Unimplemented message type: ";
  239 + text += line::_ContentType_VALUES_TO_NAMES.count(msg.contentType)
  240 + ? line::_ContentType_VALUES_TO_NAMES.at(msg.contentType)
  241 + : "TYPE " + std::to_string(msg.contentType);
  242 + text += "]</em>";
  243 +
241 244 break;
242 245 }
243 246  
... ...