mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Fix crash when entry in linphonerc is empty + don't convert commented entries
This commit is contained in:
parent
eb9886df65
commit
5c6c5073dd
2 changed files with 19 additions and 7 deletions
|
|
@ -93,12 +93,18 @@ static void lpc2xml_genericxml_warning(void *ctx, const char *fmt, ...) {
|
|||
*/
|
||||
|
||||
static int processEntry(const char *section, const char *entry, xmlNode *node, lpc2xml_context *ctx) {
|
||||
const char *comment = "#";
|
||||
if (strncmp(comment, entry, strlen(comment)) == 0) {
|
||||
lpc2xml_log(ctx, LPC2XML_WARNING, "Skipped commented entry %s", entry);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *content = lp_config_get_string(ctx->lpc, section, entry, NULL);
|
||||
if(content == NULL) {
|
||||
lpc2xml_log(ctx->ctx, LPC2XML_ERROR, "Issue when reading the lpc");
|
||||
if (content == NULL) {
|
||||
lpc2xml_log(ctx, LPC2XML_ERROR, "Issue when reading the lpc");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
lpc2xml_log(ctx, LPC2XML_MESSAGE, "Set %s|%s = %s", section, entry, content);
|
||||
xmlNodeSetContent(node, (const xmlChar *) content);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -114,15 +114,18 @@ static void dumpNodes(int level, xmlNode * a_node, xml2lpc_context *ctx) {
|
|||
|
||||
|
||||
static void dumpNode(xmlNode *node, xml2lpc_context *ctx) {
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "node type: %d, name: %s", node->type, node->name);
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "node type: %d, name: %s", node->type, node->name);
|
||||
}
|
||||
|
||||
static void dumpAttr(xmlNode *node, xml2lpc_context *ctx) {
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "attr name: %s value:%s", node->name, node->children->content);
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "attr name: %s value:%s", node->name, node->children->content);
|
||||
}
|
||||
|
||||
static void dumpContent(xmlNode *node, xml2lpc_context *ctx) {
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "content: %s", node->children->content);
|
||||
if (node->children)
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "content: %s", node->children->content);
|
||||
else
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "content: ");
|
||||
}
|
||||
|
||||
static int processEntry(xmlElement *element, const char *sectionName, xml2lpc_context *ctx) {
|
||||
|
|
@ -142,8 +145,11 @@ static int processEntry(xmlElement *element, const char *sectionName, xml2lpc_co
|
|||
}
|
||||
}
|
||||
|
||||
value = (const char *)element->children->content;
|
||||
dumpContent((xmlNode *)element, ctx);
|
||||
if (element->children)
|
||||
value = (const char *)element->children->content;
|
||||
else
|
||||
value = "";
|
||||
|
||||
if(name != NULL) {
|
||||
const char *str = lp_config_get_string(ctx->lpc, sectionName, name, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue