From aae6f456de54710bc43d27ef6532f32bc3a4dfcf Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Tue, 13 Feb 2018 10:21:10 -0800 Subject: [PATCH] Fix crash in ClangCursor::get_arguments --- src/clang_cursor.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/clang_cursor.cc b/src/clang_cursor.cc index 84dcfeed..d90928d1 100644 --- a/src/clang_cursor.cc +++ b/src/clang_cursor.cc @@ -94,6 +94,8 @@ ClangType ClangType::get_return_type() const { std::vector ClangType::get_arguments() const { int size = clang_getNumArgTypes(cx_type); + if (size < 0) + return {}; std::vector types(size); for (int i = 0; i < size; ++i) types.emplace_back(clang_getArgType(cx_type, i));