浏览代码

fix index out of range error in C# generation using msvc (#1329)

Warren Falk 7 年之前
父节点
当前提交
e7eeb7004b
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/google/protobuf/compiler/csharp/csharp_helpers.cc

+ 1 - 1
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.
   // Add a trailing "_" if the name should be altered.
-  if (input[input.size() - 1] == '#') {
+  if (input.size() > 0 && input[input.size() - 1] == '#') {
     result += '_';
     result += '_';
   }
   }
   return result;
   return result;