We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 16d4236 commit ec314c9Copy full SHA for ec314c9
unix/modos.c
@@ -137,6 +137,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_system_obj, mod_os_system);
137
138
STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) {
139
const char *s = getenv(mp_obj_str_get_str(var_in));
140
+ if (s == NULL) {
141
+ return mp_const_none;
142
+ }
143
return mp_obj_new_str(s, strlen(s), false);
144
}
145
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_obj, mod_os_getenv);
0 commit comments