Minor error handling
This commit is contained in:
parent
bee74efbde
commit
f51e167436
|
@ -534,7 +534,8 @@ font_options_t::get_font (void) const
|
||||||
destroy = (hb_destroy_func_t) g_free;
|
destroy = (hb_destroy_func_t) g_free;
|
||||||
mm = HB_MEMORY_MODE_WRITABLE;
|
mm = HB_MEMORY_MODE_WRITABLE;
|
||||||
} else {
|
} else {
|
||||||
GMappedFile *mf = g_mapped_file_new (font_file, FALSE, NULL);
|
GError *error = NULL;
|
||||||
|
GMappedFile *mf = g_mapped_file_new (font_file, FALSE, &error);
|
||||||
if (mf) {
|
if (mf) {
|
||||||
font_data = g_mapped_file_get_contents (mf);
|
font_data = g_mapped_file_get_contents (mf);
|
||||||
len = g_mapped_file_get_length (mf);
|
len = g_mapped_file_get_length (mf);
|
||||||
|
@ -544,6 +545,9 @@ font_options_t::get_font (void) const
|
||||||
mm = HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE;
|
mm = HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE;
|
||||||
} else
|
} else
|
||||||
g_mapped_file_unref (mf);
|
g_mapped_file_unref (mf);
|
||||||
|
} else {
|
||||||
|
fail (FALSE, "%s", error->message);
|
||||||
|
//g_error_free (error);
|
||||||
}
|
}
|
||||||
if (!len) {
|
if (!len) {
|
||||||
/* GMappedFile is buggy, it doesn't fail if file isn't regular.
|
/* GMappedFile is buggy, it doesn't fail if file isn't regular.
|
||||||
|
|
Loading…
Reference in New Issue