summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Storages/VCardFileStorage.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Swift/Controllers/Storages/VCardFileStorage.cpp b/Swift/Controllers/Storages/VCardFileStorage.cpp
index 5f657a4..3dff06f 100644
--- a/Swift/Controllers/Storages/VCardFileStorage.cpp
+++ b/Swift/Controllers/Storages/VCardFileStorage.cpp
@@ -61,9 +61,15 @@ void VCardFileStorage::setVCard(const JID& jid, VCard::ref v) {
}
boost::filesystem::path VCardFileStorage::getVCardPath(const JID& jid) const {
- std::string file(jid.toString());
- String::replaceAll(file, '/', "%2f");
- return boost::filesystem::path(vcardsPath / (file + ".xml"));
+ try {
+ std::string file(jid.toString());
+ String::replaceAll(file, '/', "%2f");
+ return boost::filesystem::path(vcardsPath / (file + ".xml"));
+ }
+ catch (const boost::filesystem::filesystem_error& e) {
+ std::cerr << "ERROR: " << e.what() << std::endl;
+ return boost::filesystem::path();
+ }
}
std::string VCardFileStorage::getPhotoHash(const JID& jid) const {