diff --git a/include/wrapper/cef_helpers.h b/include/wrapper/cef_helpers.h index 642313969..639cde8cb 100644 --- a/include/wrapper/cef_helpers.h +++ b/include/wrapper/cef_helpers.h @@ -97,11 +97,13 @@ struct CefDeleteOnRendererThread : public CefDeleteOnThread { }; class CefScopedArgArray { public: CefScopedArgArray(int argc, char* argv[]) { - array_ = new char*[argc]; + // argv should have (argc + 1) elements, the last one always being NULL. + array_ = new char*[argc + 1]; for (int i = 0; i < argc; ++i) { values_.push_back(argv[i]); array_[i] = const_cast(values_[i].c_str()); } + array_[argc] = NULL; } ~CefScopedArgArray() { delete [] array_;