1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

fix bug #807 that doesn't evaluates the return value of the function convertElementToVCard when detecting the file format

This commit is contained in:
babelouest 2015-02-10 14:43:23 -05:00 committed by Thomas Müller
parent 38c607e68c
commit a5b717c76b
3 changed files with 18 additions and 6 deletions

View File

@ -234,8 +234,12 @@ class ImportCsvConnector extends ImportConnector {
return 0;
} else {
$element = $this->convertElementToVCard($parts[0], $titles);
$unknownElements = $element->select("X-Unknown-Element");
return (1 - (0.5 * count($unknownElements)/count($parts[0])));
if ($element) {
$unknownElements = $element->select("X-Unknown-Element");
return (1 - (0.5 * count($unknownElements)/count($parts[0])));
} else {
return 0;
}
}
}
}

View File

@ -207,8 +207,12 @@ class ImportLdifConnector extends ImportConnector{
return 0;
} else {
$element = $this->convertElementToVCard($parts[0]);
$unknownElements = $element->select("X-Unknown-Element");
return (1 - (0.5 * count($unknownElements)/count($parts[0])));
if ($element) {
$unknownElements = $element->select("X-Unknown-Element");
return (1 - (0.5 * count($unknownElements)/count($parts[0])));
} else {
return 0;
}
}
}
}

View File

@ -199,8 +199,12 @@ class ImportVCardConnector extends ImportConnector{
return 0;
} else {
$element = $this->convertElementToVCard($parts[0]);
$unknownElements = $element->select("X-Unknown-Element");
return (1 - (0.5 * count($unknownElements)/count($parts[0])));
if ($element) {
$unknownElements = $element->select("X-Unknown-Element");
return (1 - (0.5 * count($unknownElements)/count($parts[0])));
} else {
return 0;
}
}
}