Grmph, BLF_(p)gettext were not protected against NULL message/context, was causing a sigsev with latest own commits (in File menu)!

This commit is contained in:
Bastien Montagne
2012-04-13 20:58:59 +00:00
parent 134bf10e4d
commit 889dc208bf

View File

@@ -93,7 +93,7 @@ void BLF_free_unifont(void)
const char* BLF_gettext(const char *msgid)
{
#ifdef WITH_INTERNATIONAL
if (msgid[0])
if (msgid && msgid[0])
return gettext(msgid);
return "";
#else
@@ -111,6 +111,9 @@ const char *BLF_pgettext(const char *context, const char *message)
size_t overall_length = strlen(context) + strlen(message) + sizeof(GETTEXT_CONTEXT_GLUE) + 1;
if (!message || !context || !message[0])
return "";
if (overall_length > sizeof(static_msg_ctxt_id)) {
dynamic_msg_ctxt_id = malloc(overall_length);
msg_ctxt_id = dynamic_msg_ctxt_id;