Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit f97e43c

Browse files
committed
gtk/builder: add a defensive assertion on return code
This adds a missing assertion on return codes, matching similar manual and auto-generated logic.
1 parent 3527a0b commit f97e43c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gtk/src/builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@ impl<O: IsA<Builder>> BuilderExtManual for O {
7373
fn add_from_file<T: AsRef<Path>>(&self, file_path: T) -> Result<(), glib::Error> {
7474
unsafe {
7575
let mut error = ::std::ptr::null_mut();
76-
ffi::gtk_builder_add_from_file(
76+
let exit_code = ffi::gtk_builder_add_from_file(
7777
self.upcast_ref().to_glib_none().0,
7878
file_path.as_ref().to_glib_none().0,
7979
&mut error,
8080
);
81+
assert_eq!(exit_code == 0, !error.is_null());
8182
if error.is_null() {
8283
Ok(())
8384
} else {

0 commit comments

Comments
 (0)