fix crash because server without DC, but config defined DC, see #32

This commit is contained in:
fortrue 2018-04-29 19:34:32 +08:00
parent 28edb79c61
commit bbbe798629

View File

@ -162,6 +162,9 @@ Server* ServerGroup::getReadServer(Handler* h, DC* localDC) const
continue;
}
DC* dc = s->dc();
if (!dc) {
continue;
}
int dcrp = localDC->getReadPriority(dc);
if (dcrp <= 0) {
continue;
@ -221,7 +224,7 @@ Server* ServerGroup::getReadServer(Handler* h, DC* localDC) const
dc = sdc[0];
found = true;
}
if (!found) {//dc maybe nullptr even we found
if (!found) {
return nullptr;
}
Server* deadServs[Const::MaxServInGroup];