Skip to content

Commit 978b967

Browse files
authored
Fix crash in unreachable/overloaded RDS (istio#190)
1 parent 557d0c6 commit 978b967

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/envoy/mixer/http_filter.cc

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,29 @@ class Instance : public Http::StreamDecoderFilter,
156156

157157
// mixer control switch (off by default)
158158
bool mixer_disabled() {
159-
auto route = decoder_callbacks_->route()->routeEntry();
159+
auto route = decoder_callbacks_->route();
160160
if (route != nullptr) {
161-
auto key = route->opaqueConfig().find(kJsonNameMixerSwitch);
162-
if (key != route->opaqueConfig().end() && key->second == "on") {
163-
return false;
161+
auto entry = route->routeEntry();
162+
if (entry != nullptr) {
163+
auto key = entry->opaqueConfig().find(kJsonNameMixerSwitch);
164+
if (key != entry->opaqueConfig().end() && key->second == "on") {
165+
return false;
166+
}
164167
}
165168
}
166169
return true;
167170
}
168171

169172
// attribute forward switch (on by default)
170173
bool forward_disabled() {
171-
auto route = decoder_callbacks_->route()->routeEntry();
174+
auto route = decoder_callbacks_->route();
172175
if (route != nullptr) {
173-
auto key = route->opaqueConfig().find(kJsonNameForwardSwitch);
174-
if (key != route->opaqueConfig().end() && key->second == "off") {
175-
return true;
176+
auto entry = route->routeEntry();
177+
if (entry != nullptr) {
178+
auto key = entry->opaqueConfig().find(kJsonNameForwardSwitch);
179+
if (key != entry->opaqueConfig().end() && key->second == "off") {
180+
return true;
181+
}
176182
}
177183
}
178184
return false;

0 commit comments

Comments
 (0)