]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/alloc_entry.c
ncurses 6.1 - patch 20180512
[ncurses.git] / ncurses / tinfo / alloc_entry.c
index 5de09f1e4b9ff2cdbaacf21b1b43d319ed012907..fe7892f4c6184275f806211cec537631213c2a4b 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2013,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -47,7 +47,7 @@
 
 #include <tic.h>
 
 
 #include <tic.h>
 
-MODULE_ID("$Id: alloc_entry.c,v 1.60 2017/06/27 23:48:55 tom Exp $")
+MODULE_ID("$Id: alloc_entry.c,v 1.62 2018/04/14 20:32:09 tom Exp $")
 
 #define ABSENT_OFFSET    -1
 #define CANCELLED_OFFSET -2
 
 #define ABSENT_OFFSET    -1
 #define CANCELLED_OFFSET -2
@@ -98,7 +98,7 @@ _nc_save_str(const char *const string)
     size_t old_next_free = next_free;
     size_t len;
 
     size_t old_next_free = next_free;
     size_t len;
 
-    if (string == 0)
+    if (!VALID_STRING(string))
        return _nc_save_str("");
     len = strlen(string) + 1;
 
        return _nc_save_str("");
     len = strlen(string) + 1;
 
@@ -229,6 +229,9 @@ _nc_merge_entry(ENTRY * const target, ENTRY * const source)
     TERMTYPE2 *from = &(source->tterm);
     unsigned i;
 
     TERMTYPE2 *from = &(source->tterm);
     unsigned i;
 
+    if (source == 0 || from == 0 || target == 0 || to == 0)
+       return;
+
 #if NCURSES_XNAMES
     _nc_align_termtype(to, from);
 #endif
 #if NCURSES_XNAMES
     _nc_align_termtype(to, from);
 #endif