File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -618,10 +618,11 @@ t_stat sim_disk_clr_async (UNIT *uptr)
618618#if !defined(SIM_ASYNCH_IO )
619619return SCPE_NOFNC ;
620620#else
621- struct disk_context * ctx = ( struct disk_context * ) uptr -> disk_ctx ;
621+ struct disk_context * ctx ;
622622
623623/* make sure device exists */
624- if (!ctx ) return SCPE_UNATT ;
624+ if (uptr == NULL || (ctx = (struct disk_context * ) uptr -> disk_ctx , ctx == NULL ))
625+ return SCPE_UNATT ;
625626
626627sim_debug_unit (ctx -> dbit , uptr , "sim_disk_clr_async(unit=%d)\n" , (int )(uptr - ctx -> dptr -> units ));
627628
@@ -946,16 +947,21 @@ return SCPE_OK;
946947*/
947948static void _sim_disk_io_flush (UNIT * uptr )
948949{
949- uint32 f = DK_GET_FMT (uptr );
950+ if (uptr == NULL )
951+ return ;
950952
951953#if defined (SIM_ASYNCH_IO )
952- struct disk_context * ctx = (struct disk_context * )uptr -> disk_ctx ;
954+ struct disk_context * ctx ;
955+
956+ if (ctx = (struct disk_context * )uptr -> disk_ctx , ctx == NULL )
957+ return ;
953958
954959sim_disk_clr_async (uptr );
955960if (sim_asynch_enabled )
956961 sim_disk_set_async (uptr , ctx -> asynch_io_latency );
957962#endif
958- switch (f ) { /* case on format */
963+
964+ switch (DK_GET_FMT (uptr )) { /* case on format */
959965 case DKUF_F_STD : /* Simh */
960966 fflush (uptr -> fileref );
961967 break ;
You can’t perform that action at this time.
0 commit comments