File tree Expand file tree Collapse file tree
python_bindings/src/halide/halide_ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,6 +159,10 @@ void define_generator(py::module &m) {
159159
160160 m.def (" _generate_filter_main" , //
161161 [](const std::vector<std::string> &arguments) -> void {
162+ if (arguments.empty ()) {
163+ throw std::invalid_argument (" No arguments provided to _generate_filter_main" );
164+ }
165+
162166 // POSIX requires argv to be mutable and null-terminated
163167 std::vector<char *> argv;
164168 argv.reserve (arguments.size () + 1 );
@@ -168,7 +172,7 @@ void define_generator(py::module &m) {
168172 argv.push_back (nullptr );
169173
170174 const int result = Halide::Internal::generate_filter_main (
171- ( int ) argv.size () - 1 , argv.data (), PyGeneratorFactoryProvider ());
175+ static_cast < int >( argv.size () ) - 1 , argv.data (), PyGeneratorFactoryProvider ());
172176 if (result != 0 ) {
173177 // Some paths in generate_filter_main() will fail with user_error
174178 // or similar (which throws an exception due to how libHalide is
You can’t perform that action at this time.
0 commit comments