Default permalink structure causing Notice: Undefined property: WP_Query::$post

Finally I found what causing this problem, turns out it have to do with my pre_get_post hook. Because I using is_page to check the specific page, which is not appropriate.

Here is what I did

function check_page($wp_query){
   if($wp_query->is_page(array('1','2','3')) ){
           //do something here
     }
  return $wp_query;
}
add_action( 'pre_get_posts', 'check_page' );

So my solution to this is:

 function check_page($wp_query){
    $pageidarray = array('1','2','3');
   if($wp_query->is_page() && in_array($wp_query->query_vars['page_id'], $pageidarray) ){
           //do something here
     }
  return $wp_query;
}
add_action( 'pre_get_posts', 'check_page' );

Problem solved.