From e7eeb7004bbda01f62ea5e66f156645c3dadf1e2 Mon Sep 17 00:00:00 2001 From: Warren Falk Date: Mon, 14 May 2018 16:39:26 -0400 Subject: fix index out of range error in C# generation using msvc (#1329) --- src/google/protobuf/compiler/csharp/csharp_helpers.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc index 5bca1ffa..04b61074 100644 --- a/src/google/protobuf/compiler/csharp/csharp_helpers.cc +++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc @@ -169,7 +169,7 @@ std::string UnderscoresToCamelCase(const std::string& input, } } // Add a trailing "_" if the name should be altered. - if (input[input.size() - 1] == '#') { + if (input.size() > 0 && input[input.size() - 1] == '#') { result += '_'; } return result; -- cgit v1.2.3