File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -6700,17 +6700,17 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
6700
6700
}
6701
6701
6702
6702
if (remove_flag) {
6703
- // Shift the remainder of the argv list left by one. Note
6704
- // that argv has (*argc + 1) elements, the last one always being
6705
- // NULL. The following loop moves the trailing NULL element as
6706
- // well.
6707
- for (int j = i; j != *argc; j++) {
6708
- argv[j] = argv[j + 1 ];
6703
+ // Shift the remainder of the argv list left by one.
6704
+ for (int j = i + 1 ; j < *argc; ++j) {
6705
+ argv[j - 1 ] = argv[j];
6709
6706
}
6710
6707
6711
6708
// Decrements the argument count.
6712
6709
(*argc)--;
6713
6710
6711
+ // Terminate the array with nullptr.
6712
+ argv[*argc] = nullptr ;
6713
+
6714
6714
// We also need to decrement the iterator as we just removed
6715
6715
// an element.
6716
6716
i--;
You can’t perform that action at this time.
0 commit comments