From 3fe1418b08adb7d058b9203303a26e31009606a5 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Tue, 18 Feb 2014 18:45:25 +0100 Subject: [PATCH] detect broken cache --- src/core/plugins/plugincontainer.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/plugins/plugincontainer.cpp b/src/core/plugins/plugincontainer.cpp index 7111e1f..d58130f 100644 --- a/src/core/plugins/plugincontainer.cpp +++ b/src/core/plugins/plugincontainer.cpp @@ -184,8 +184,19 @@ const QHash PluginContainer::pluginCache(SnorePlugin { cache().setArrayIndex(i); SnorePlugin::PluginTypes type = (SnorePlugin::PluginTypes)cache().value("type").toInt(); - PluginContainer *info = new PluginContainer(cache().value("fileName").toString(),cache().value("name").toString(),type); - s_pluginCache[type].insert(info->name(), info); + QString fileName = cache().value("fileName").toString(); + if(QFile(pluginDir().absoluteFilePath(fileName)).exists()) + { + PluginContainer *info = new PluginContainer(fileName, cache().value("name").toString(), type); + s_pluginCache[type].insert(info->name(), info); + } + else + { + snoreDebug( SNORE_WARNING ) << "Cache Corrupted" << fileName << cache().value("name").toString() << type; + cache().endArray(); + updatePluginCache(); + break; + } } cache().endArray(); }