[gvfs] MTP: Fix crash when libmtp operations fails without error message.
- From: Philip Langdale <philipl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] MTP: Fix crash when libmtp operations fails without error message.
- Date: Mon, 11 Feb 2013 15:50:07 +0000 (UTC)
commit 828a5cd1db7a352820f4979095389fb4a24e728f
Author: Philip Langdale <philipl overt org>
Date: Mon Feb 11 07:46:56 2013 -0800
MTP: Fix crash when libmtp operations fails without error message.
daemon/gvfsbackendmtp.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c
index efd1943..ba04028 100644
--- a/daemon/gvfsbackendmtp.c
+++ b/daemon/gvfsbackendmtp.c
@@ -280,14 +280,20 @@ emit_change_event (gpointer key,
static void
fail_job (GVfsJob *job, LIBMTP_mtpdevice_t *device)
{
+ const char *text;
LIBMTP_error_t *error = LIBMTP_Get_Errorstack (device);
+ if (error) {
+ text = g_strrstr (error->error_text, ":") + 1;
+ } else {
+ text = _("Unknown error.");
+ }
g_vfs_job_failed (job, G_IO_ERROR,
g_vfs_job_is_cancelled (job) ?
G_IO_ERROR_CANCELLED :
G_IO_ERROR_FAILED,
_("libmtp error: %s"),
- g_strrstr (error->error_text, ":") + 1);
+ text);
LIBMTP_Clear_Errorstack (device);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]