diff options
author | Adam <Adam@anope.org> | 2011-08-08 23:41:03 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-08-09 17:39:25 -0400 |
commit | 5d6f4cfea4df8a4138fcbb4fc9eaaf607c0c0a55 (patch) | |
tree | 85c579d09a17bd035eb739ed9dbe4a17e88d40b5 /src | |
parent | 2b03500a613c04d9082c2df29a88e098fc4d5d5a (diff) |
Added a few sanity checks which never really should happen to db-convert
(cherry picked from commit b7542fd6f29b5fec45314dbf65f599c5bd2b3650)
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/db-convert.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tools/db-convert.cpp b/src/tools/db-convert.cpp index 4d335b18f..16dc3516a 100644 --- a/src/tools/db-convert.cpp +++ b/src/tools/db-convert.cpp @@ -357,6 +357,12 @@ int main(int argc, char *argv[]) std::string cpass; for (nc = nclists[i]; nc; nc = nc->next) { + if (!nc->display) + { + std::cout << "Skipping core with no display" << std::endl; + continue; + } + if (nc->aliascount < 1) { std::cout << "Skipping core with 0 or less aliases (wtf?)" << std::endl; @@ -429,8 +435,8 @@ int main(int argc, char *argv[]) memos = nc->memos.memos; for (j = 0; j < nc->memos.memocount; ++j, ++memos) { - if (!memos->text) - break; + if (!memos->text || !memos->sender) + continue; fs << "MD MI " << memos->time << " " << memos->sender; if (memos->flags & MF_UNREAD) fs << " UNREAD"; @@ -469,7 +475,7 @@ int main(int argc, char *argv[]) fs << "MD FLAGS" << (na->status & NS_FORBIDDEN ? " FORBIDDEN" : "") << (na->status & NS_NO_EXPIRE ? " NOEXPIRE" : "") << std::endl; HostCore *hc = findHostCore(na->nick); - if (hc) + if (hc && hc->creator && hc->vHost) fs << "MD VHOST " << hc->creator << " " << hc->time << " " << hc->vHost << " :" << (hc->vIdent ? hc->vIdent : "") << std::endl; } } @@ -828,10 +834,10 @@ int main(int argc, char *argv[]) fs << "MD URL :" << ci->url << std::endl; if (ci->email) fs << "MD EMAIL :" << ci->email << std::endl; - if (ci->last_topic) // MD CH topic <setter> <time> :topic + if (ci->last_topic && ci->last_topic_setter) // MD CH topic <setter> <time> :topic fs << "MD TOPIC " << ci->last_topic_setter << " " << ci->last_topic_time << " :" << ci->last_topic << std::endl; if (ci->flags & CI_FORBIDDEN) - fs << "MD FORBID " << ci->forbidby << " :" << (ci->forbidreason ? ci->forbidreason : "no reason given") << std::endl; + fs << "MD FORBID " << (ci->forbidby ? ci->forbidby : "db-convert") << " :" << (ci->forbidreason ? ci->forbidreason : "no reason given") << std::endl; for (j = 0; j < ci->accesscount; ++j) // MD ACCESS <display> <level> <last_seen> <creator> - creator isn't in 1.9.0-1, but is in 1.9.2 |