fixing COM-15
authorVolker Birk <vb@pep-project.org>
Sun, 13 Nov 2016 16:28:45 +0100
changeset 2113e6efc641a02
parent 210 05ce89e74ac6
child 212 33bddd7ba879
fixing COM-15
pEp_utility.cpp
     1.1 --- a/pEp_utility.cpp	Sun Nov 13 16:19:39 2016 +0100
     1.2 +++ b/pEp_utility.cpp	Sun Nov 13 16:28:45 2016 +0100
     1.3 @@ -295,7 +295,18 @@
     1.4              assert(msg2);
     1.5              assert(msg);
     1.6  
     1.7 -            clear_text_message(msg2);
     1.8 +			if (!msg2) {
     1.9 +				msg2 = (TextMessage *)calloc(1, sizeof(TextMessage));
    1.10 +				assert(msg2);
    1.11 +				if (!msg2)
    1.12 +					throw bad_alloc();
    1.13 +			}
    1.14 +			else {
    1.15 +				clear_text_message(msg2);
    1.16 +			}
    1.17 +
    1.18 +			if (!msg)
    1.19 +				return;
    1.20  
    1.21              msg2->Dir = (pEpMsgDirection) msg->dir;
    1.22              msg2->Id = bstr(msg->id);