[ghex] appwin: Only attempt to set direct buffer if it can be loaded
- From: Logan Rathbone <larathbone src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ghex] appwin: Only attempt to set direct buffer if it can be loaded
- Date: Fri, 17 Jun 2022 03:32:02 +0000 (UTC)
commit 274fc1f3136f51d164e0c456aa161c0dbf92d059
Author: Logan Rathbone <poprocks gmail com>
Date: Thu Jun 16 23:29:37 2022 -0400
appwin: Only attempt to set direct buffer if it can be loaded
src/ghex-application-window.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/ghex-application-window.c b/src/ghex-application-window.c
index 8753a01..32b39e9 100644
--- a/src/ghex-application-window.c
+++ b/src/ghex-application-window.c
@@ -2212,7 +2212,12 @@ ghex_application_window_open_file (GHexApplicationWindow *self, GFile *file)
g_debug ("%s: attempting to set buffer to `direct`", __func__);
buf = hex_buffer_util_new ("direct", file);
- hex_document_set_buffer (doc, buf);
+ if (buf)
+ hex_document_set_buffer (doc, buf);
+ else
+ g_debug ("%s: setting buffer to `direct` failed. If this is "
+ "an attempt to open a block device, it will likely fail.",
+ __func__);
}
gh = HEX_WIDGET(hex_widget_new (doc));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]