From a27a915a138df43f4cde6a964f7ef9991996be6f Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Thu, 28 Mar 2019 21:40:41 +0100 Subject: caja-file-operations: make sure 'error' isn't NULL Fixes Clang static analyzer warnings: caja-file-operations.c:2165:7: warning: Access to field 'code' results in a dereference of a null pointer (loaded from variable 'error') if (error->code != G_IO_ERROR_FAILED_HANDLED) { ^~~~~~~~~~~ caja-file-operations.c:5448:14: warning: Access to field 'message' results in a dereference of a null pointer (loaded from variable 'error') details = error->message; ^~~~~~~~~~~~~~ --- libcaja-private/caja-file-operations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index 968cf5e6..6de6fdfe 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -2162,7 +2162,7 @@ unmount_mount_callback (GObject *source_object, } if (! unmounted) { - if (error->code != G_IO_ERROR_FAILED_HANDLED) { + if (error && error->code != G_IO_ERROR_FAILED_HANDLED) { if (data->eject) { primary = f (_("Unable to eject %V"), source_object); } else { @@ -5445,7 +5445,7 @@ link_file (CopyMoveJob *job, details = NULL; } else { secondary = f (_("There was an error creating the symlink in %F."), dest_dir); - details = error->message; + details = error ? error->message : NULL; } response = run_warning (common, -- cgit v1.2.1