Buggy code:
public abstract class OnlineVideoAdapter extends VideoBaseAdapter < SectionItemInterface > { IDatabase dbStore ; IStorage storage ; public OnlineVideoAdapter ( Context context , IEdxEnvironment environment ) { } @ Override public void render ( BaseViewHolder tag , final SectionItemInterface sectionItem ) { final OnlineVideoAdapter . ViewHolder holder = ( ( OnlineVideoAdapter . ViewHolder ) ( tag ) ) ; if ( sectionItem != null ) { if ( sectionItem . isChapter ( ) ) { holder . videolayout . setVisibility ( GONE ) ; ChapterModel c = ( ( ChapterModel ) ( sectionItem ) ) ; holder . course_title . setText ( c . name ) ; holder . course_title . setVisibility ( VISIBLE ) ; holder . section_title . setVisibility ( GONE ) ; } else if ( sectionItem . isSection ( ) ) { holder . videolayout . setVisibility ( GONE ) ; SectionItemModel s = ( ( SectionItemModel ) ( sectionItem ) ) ; holder . section_title . setText ( s . name ) ; holder . section_title . setVisibility ( VISIBLE ) ; holder . course_title . setVisibility ( GONE ) ; } else { holder . course_title . setVisibility ( GONE ) ; holder . section_title . setVisibility ( GONE ) ; holder . videolayout . setVisibility ( VISIBLE ) ; final DownloadEntry videoData = ( ( DownloadEntry ) ( sectionItem ) ) ; final String selectedVideoId = getVideoId ( ) ; holder . videoTitle . setText ( videoData . getTitle ( ) ) ; holder . videoSize . setText ( MemoryUtil . format ( getContext ( ) , videoData . size ) ) ; holder . videoPlayingTime . setText ( videoData . getDurationReadable ( ) ) ; if ( ( videoData . downloaded ) == ( DownloadedState . DOWNLOADING ) ) { holder . progresslayout . setVisibility ( VISIBLE ) ; holder . video_download_layout . setVisibility ( GONE ) ; <START_BUG> NativeDownloadModel downloadModel = storage . getNativeDownlaod ( videoData . dmId ) ; <END_BUG> if ( downloadModel != null ) { int percent = downloadModel . getPercent ( ) ; if ( ( percent >= 0 ) && ( percent < 100 ) ) { holder . progresslayout . setVisibility ( VISIBLE ) ; holder . download_pw . setProgressPercent ( percent ) ; } else { holder . progresslayout . setVisibility ( GONE ) ; } } } dbStore . getWatchedStateForVideoId ( videoData . videoId , new org . edx . mobile . module . db . DataCallback < DownloadEntry . WatchedState > ( true ) { @ Override public void onResult ( DownloadEntry . WatchedState result ) { DownloadEntry . WatchedState ws = result ; if ( ( ws == null ) || ( ws == ( WatchedState . UNWATCHED ) ) ) { holder . video_watched_status . setImageResource ( cyan_circle ) ; } else if ( ws == ( WatchedState . PARTIALLY_WATCHED ) ) { holder . video_watched_status . setImageResource ( ic_partially_watched ) ; } else { holder . video_watched_status . setImageResource ( grey_circle ) ; } } @ Override public void onFail ( Exception ex ) { logger . error ( ex ) ; } } ) ; dbStore . getDownloadedStateForVideoId ( videoData . videoId , new org . edx . mobile . module . db . DataCallback < DownloadEntry . DownloadedState > ( true ) { @ Override public void onResult ( DownloadEntry . DownloadedState result ) { DownloadEntry . DownloadedState ds = result ; if ( ( ds == null ) || ( ds == ( DownloadedState . ONLINE ) ) ) { holder . video_download_layout . setVisibility ( VISIBLE ) ; holder . progresslayout . setVisibility ( GONE ) ; holder . video_download_layout . setOnClickListener ( new OnClickListener ( ) { @ Override public void onClick ( View v ) { holder . progresslayout . setVisibility ( VISIBLE ) ; holder . video_download_layout . setVisibility ( GONE ) ; logger . debug ( "Download<seq2seq4repair_space>Button<seq2seq4repair_space>Clicked" ) ; download ( videoData , holder . download_pw ) ; } } ) ; } else if ( ds == ( DownloadedState . DOWNLOADING ) ) { holder . progresslayout . setVisibility ( VISIBLE ) ; holder . video_download_layout . setVisibility ( GONE ) ; storage . getDownloadProgressByDmid ( videoData . dmId , new org . edx . mobile . module . db . DataCallback < Integer > ( true ) { @ Override public void onResult ( Integer result ) { if ( ( result >= 0 ) && ( result < 100 ) ) { holder . progresslayout . setVisibility ( VISIBLE ) ; holder . download_pw . setProgressPercent ( result ) ; } else { holder . progresslayout . setVisibility ( GONE ) ; } } @ Override public void onFail ( Exception ex ) { logger . error ( ex ) ; holder . progresslayout . setVisibility ( GONE ) ; holder . video_download_layout . setVisibility ( VISIBLE ) ; } } ) ; } else if ( ds == ( DownloadedState . DOWNLOADED ) ) { holder . video_download_layout . setVisibility ( GONE ) ; holder . progresslayout . setVisibility ( GONE ) ; } if ( selectedVideoId != null ) { if ( selectedVideoId . equalsIgnoreCase ( videoData . videoId ) ) { holder . videolayout . setBackgroundResource ( cyan_text_navigation_20 ) ; if ( isPlayerOn ) { holder . video_download_layout . setVisibility ( GONE ) ; } } else { holder . videolayout . setBackgroundResource ( list_item_overlay_selector ) ; } } else { holder . videolayout . setBackgroundResource ( list_item_overlay_selector ) ; } } @ Override public void onFail ( Exception ex ) { logger . error ( ex ) ; holder . progresslayout . setVisibility ( GONE ) ; holder . video_download_layout . setVisibility ( VISIBLE ) ; } } ) ; holder . videoSize . setVisibility ( GONE ) ; } } } @ Override public BaseViewHolder getTag ( View convertView ) { } private static class ViewHolder extends BaseViewHolder { TextView videoTitle ;

Fix:
NativeDownloadModel downloadModel = storage . getNativeDownload ( videoData . dmId ) ;