Explorar el Código

1、【修复】usocket 构造时存在空指针问题。

Signed-off-by: armink <armink.ztl@gmail.com>
armink hace 8 años
padre
commit
2463186c73
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      port/modusocket.c

+ 1 - 1
port/modusocket.c

@@ -61,7 +61,6 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
 
     mp_arg_check_num(n_args, n_kw, 0, 4, false);
 
-    s->base.type = (mp_obj_t)&socket_type;
 
     if (n_args >= 1) {
         domain = mp_obj_get_int(args[0]);
@@ -74,6 +73,7 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
 
     if (fd != -1) {
         s = m_new_obj_with_finaliser(posix_socket_obj_t);
+        s->base.type = (mp_obj_t)&socket_type;
         if (s) {
             s->fd = fd;
         }