diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index a88cf6e65bd..7a50ccd2271 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1001,8 +1001,13 @@ retry: does not exist, we handle the situation in the function which called this function */ - if (!space || UT_LIST_GET_FIRST(space->chain)->open) { + if (!space) { + return; + } + fil_node_t* node = UT_LIST_GET_FIRST(space->chain); + + if (!node || node->open) { return; } diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index 440b95daa18..803f3a81cbd 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -1002,8 +1002,13 @@ retry: /* If the file is already open, no need to do anything; if the space does not exist, we handle the situation in the function which called this function */ + if (!space) { + return; + } - if (!space || UT_LIST_GET_FIRST(space->chain)->open) { + fil_node_t* node = UT_LIST_GET_FIRST(space->chain); + + if (!node || node->open) { return; }