Skip to content

Commit c7e73ea

Browse files
committed
Merge #10151: [logging] initialize flag variable to 0 (and continue if GetLogCategory() fails)
cd7f394 initialize flag variable to 0 (and continue if GetLogCategory() fails) (John Newbery) Tree-SHA512: d0f2653bd0e71ed763220cb08d3a5335c5bdfe2f54ff7f9302d97f3265d7aa7f57606fe416a61aaac1535dbb046d0fb40a61f5a9d5cf234b042268e00ee7679d
2 parents 3c95bd4 + cd7f394 commit c7e73ea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/init.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,9 +910,10 @@ bool AppInitParameterInteraction()
910910

911911
if (find(categories.begin(), categories.end(), std::string("0")) == categories.end()) {
912912
for (const auto& cat : categories) {
913-
uint32_t flag;
913+
uint32_t flag = 0;
914914
if (!GetLogCategory(&flag, &cat)) {
915915
InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debug", cat));
916+
continue;
916917
}
917918
logCategories |= flag;
918919
}
@@ -923,9 +924,10 @@ bool AppInitParameterInteraction()
923924
if (mapMultiArgs.count("-debugexclude") > 0) {
924925
const std::vector<std::string>& excludedCategories = mapMultiArgs.at("-debugexclude");
925926
for (const auto& cat : excludedCategories) {
926-
uint32_t flag;
927+
uint32_t flag = 0;
927928
if (!GetLogCategory(&flag, &cat)) {
928929
InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat));
930+
continue;
929931
}
930932
logCategories &= ~flag;
931933
}

0 commit comments

Comments
 (0)