[virt-tools-list] [virt-viewer PATCH] Test error->message and, if NULL, use a default message

Christophe Fergeau cfergeau at redhat.com
Fri Feb 10 14:56:52 UTC 2017


On Fri, Feb 10, 2017 at 03:50:36PM +0100, Pavel Grunt wrote:
> On Thu, 2017-02-09 at 18:46 +0100, Christophe de Dinechin wrote:
> > I tend to agree. I don’t see how any legitimate GError * (from
> > g_error_new or the like) would have a NULL message. So this is
> > really defensive coding.
> > 
> nothing prevents calling g_error_new with a NULL message :) I know it
> is not our case
> 
> > Alternate solution would be to assert, but I don’t like killing the
> > viewer if this ever happens.
> > 
> > 
> No need, I think 
>  const char *str = NULL;
>  g_print("%s", str);
> does not crash and prints (null)

Bit of old trivia, on Solaris this (used to?) crashes

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20170210/b407d35c/attachment.sig>


More information about the virt-tools-list mailing list