You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/01/27 09:23:46 UTC

[incubator-nuttx] 02/02: symtab_findbyvalue: just retun NULL for NULL symtab

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit dad4a7f8f7f9e5023faedefdfcdf0180010fea71
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Jan 27 13:23:17 2022 +0900

    symtab_findbyvalue: just retun NULL for NULL symtab
---
 libs/libc/symtab/symtab_findbyvalue.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libs/libc/symtab/symtab_findbyvalue.c b/libs/libc/symtab/symtab_findbyvalue.c
index b1ecdae..86ac081 100644
--- a/libs/libc/symtab/symtab_findbyvalue.c
+++ b/libs/libc/symtab/symtab_findbyvalue.c
@@ -62,7 +62,11 @@ symtab_findbyvalue(FAR const struct symtab_s *symtab,
   int low  = 0;
 #endif
 
-  DEBUGASSERT(symtab != NULL);
+  if (symtab == NULL)
+    {
+      DEBUGASSERT(nsyms == 0);
+      return NULL;
+    }
 
 #ifdef CONFIG_SYMTAB_ORDEREDBYVALUE