浏览代码

fix(js_generator): check for proto

Peter Marton 7 年之前
父节点
当前提交
e479adf394
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      src/google/protobuf/compiler/js/js_generator.cc

+ 1 - 0
src/google/protobuf/compiler/js/js_generator.cc

@@ -1681,6 +1681,7 @@ void Generator::GenerateProvides(const GeneratorOptions& options,
       if (options.import_style == GeneratorOptions::kImportCommonJsStrict) {
         string namespaceObject = *it;
         // Remove "proto." from the namespace object
+        GOOGLE_CHECK(namespaceObject.compare(0, 6, "proto."));
         namespaceObject.erase(0, 6);
         printer->Print("goog.exportSymbol('$name$', null, proto);\n", "name",
                 namespaceObject);