We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6ff1c1d + 449e101 commit c15e221Copy full SHA for c15e221
src/clang.rs
@@ -793,9 +793,11 @@ impl Comment {
793
}
794
795
/// Get this comment's `idx`th child comment
796
- pub fn get_child(&self, idx: c_uint) -> Comment {
797
- unsafe {
798
- Comment { x: clang_Comment_getChild(self.x, idx) }
+ pub fn get_child(&self, idx: c_uint) -> Option<Comment> {
+ if idx >= self.num_children() {
+ None
799
+ } else {
800
+ Some(Comment { x: unsafe { clang_Comment_getChild(self.x, idx) } })
801
802
803
src/ir/annotations.rs
@@ -153,7 +153,7 @@ impl Annotations {
153
154
155
for i in 0..comment.num_children() {
156
- self.parse(&comment.get_child(i), matched);
+ self.parse(&comment.get_child(i).unwrap(), matched);
157
158
159
0 commit comments