[babl] bug #783704, Check db NULL to avoid segfault if babl not initiated,
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] bug #783704, Check db NULL to avoid segfault if babl not initiated,
- Date: Tue, 13 Jun 2017 07:26:48 +0000 (UTC)
commit 25b29df94f2ac5aac35d1195608529e47ebad943
Author: Guiu Rocafort <neandertalspeople gmail com>
Date: Tue Jun 13 09:21:29 2017 +0200
bug #783704, Check db NULL to avoid segfault if babl not initiated,
babl/babl-internal.h | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index 228faa5..42262d6 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -265,14 +265,22 @@ BABL_CLASS_MINIMAL_IMPLEMENT(klass) \
const Babl * \
babl_##klass (const char *name) \
{ \
- Babl *babl; \
+ Babl *babl = NULL; \
\
if (babl_hmpf_on_name_lookups) \
{ \
babl_log ("%s(\"%s\"): hmpf!", G_STRFUNC, name); \
} \
- babl = babl_db_exist_by_name (db, name); \
\
+ if( db != NULL ) \
+ { \
+ babl = babl_db_exist_by_name (db, name); \
+ } \
+ else{ \
+ babl_fatal("You must call babl_init() first"); \
+ } \
+ \
+ \
if (!babl) \
{ \
babl_fatal ("%s(\"%s\"): not found", G_STRFUNC, name); \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]