Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed segfault on uems->default is NULL #972

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugins/emperor_mongodb/emperor_mongodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ extern "C" void uwsgi_imperial_monitor_mongodb(struct uwsgi_emperor_scanner *ues
}
mongo::BSONObj p = builder.obj();
mongo::BSONObj q = mongo::fromjson(uems->json);
mongo::BSONObj d = mongo::fromjson(uems->defaults);

std::unique_ptr<mongo::DBClientBase> conn;

Expand Down Expand Up @@ -101,8 +100,9 @@ extern "C" void uwsgi_imperial_monitor_mongodb(struct uwsgi_emperor_scanner *ues
while(e_attrs) {
const char *attr_value = p.getStringField(e_attrs->value);
if (strlen(attr_value) == 0) attr_value = NULL;

if (!attr_value) {
// uems->defaults can be NULL
if (!attr_value && uems->defaults) {
mongo::BSONObj d = mongo::fromjson(uems->defaults);
mongo::BSONElement tmp = d.getField(e_attrs->value);

if (tmp.type() == mongo::Array) {
Expand Down