aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarren Falk <warren@warrenfalk.com>2018-05-14 16:39:26 -0400
committerJie Luo <anandolee@gmail.com>2018-05-14 13:39:26 -0700
commite7eeb7004bbda01f62ea5e66f156645c3dadf1e2 (patch)
tree383921343a9a3f20df798159c8228b50e0280659
parentb61dd9d9a229c5a82788fdeefa344aa65affae09 (diff)
downloadprotobuf-e7eeb7004bbda01f62ea5e66f156645c3dadf1e2.tar.gz
protobuf-e7eeb7004bbda01f62ea5e66f156645c3dadf1e2.tar.bz2
protobuf-e7eeb7004bbda01f62ea5e66f156645c3dadf1e2.zip
fix index out of range error in C# generation using msvc (#1329)
-rw-r--r--src/google/protobuf/compiler/csharp/csharp_helpers.cc2
1 files changed, 1 insertions, 1 deletions
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;