Store cached info only for queries with matadata
Fixes problem error in corpusStats.
Change-Id: Ic89ef796837d2f7f381b7234c1963b2526385073
diff --git a/R/KorAPConnection.R b/R/KorAPConnection.R
index 90f72c1..1d6ba82 100644
--- a/R/KorAPConnection.R
+++ b/R/KorAPConnection.R
@@ -149,7 +149,8 @@
if (kco@cache) {
parsed <- R.cache::loadCache(dir=KorAPCacheSubDir(), key=list(url, kco@accessToken))
if (!is.null(parsed)) {
- parsed$meta$cached <- "local"
+ if (!is.null(parsed$META))
+ parsed$meta$cached <- "local"
return(parsed)
}
}