From 132f389bfde4c156f340dc9103fde93ecd193a86 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 14 Dec 2015 16:16:11 +0100 Subject: [PATCH] Fix crash when selected file doesn't contain any vcard --- coreapi/vcard.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coreapi/vcard.cc b/coreapi/vcard.cc index 4d1a135b3..29b14b912 100644 --- a/coreapi/vcard.cc +++ b/coreapi/vcard.cc @@ -38,10 +38,10 @@ extern "C" void linphone_vcard_free(LinphoneVCard *vcard) { extern "C" MSList* linphone_vcard_new_from_vcard4_file(const char *filename) { MSList *result = NULL; - if (filename) { - if (ortp_file_exist(filename) == 0) { - belcard::BelCardParser *parser = new belcard::BelCardParser(); - shared_ptr belCards = parser->parseFile(filename); + if (filename && ortp_file_exist(filename) == 0) { + belcard::BelCardParser *parser = new belcard::BelCardParser(); + shared_ptr belCards = parser->parseFile(filename); + if (belCards) { for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) { shared_ptr belcard = (*it); LinphoneVCard *vcard = linphone_vcard_new();