Skip to content

Commit

Permalink
Merge pull request #58 from rees46/bug/stories-null-pointer-error
Browse files Browse the repository at this point in the history
Fix: Nullpointer in StoriesView
  • Loading branch information
TorinAsakura authored Sep 9, 2024
2 parents 7280a3e + 4860d30 commit 3a34e75
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void setPlayer(Player player) {
}

/**
* Вызывать, когда объект сторисов удален с экрана и больше не нужен
* Call when the story object is removed from the screen and is no longer needed
*/
public void release() {
getPlayer().release();
Expand All @@ -96,15 +96,13 @@ private void parseAttrs(AttributeSet attrs) {
setCode(typedArray.getString(R.styleable.StoriesView_code));
}

//Инициализация
private void initialize() {
View view = inflate(getContext(), R.layout.stories, this);
RecyclerView stories = view.findViewById(R.id.stories);

adapter = new StoriesAdapter(this, list, this);
stories.setAdapter(adapter);

//Плеер для просмотра видео
setPlayer(new Player(getContext()));

getSettings().failed_load_text = getResources().getString(R.string.failed_load_text);
Expand All @@ -131,7 +129,7 @@ public void onStoryClick(int index) {
}

/**
* Устанавливает слушатель клика по элементам
* Sets a click listener on elements
* @param listener OnLinkClickListener
*/
public void setOnLinkClickListener(@Nullable OnLinkClickListener listener) {
Expand Down Expand Up @@ -164,8 +162,9 @@ public void onChange(boolean selfChange) {
}

public void unregisterObserver() {
if( observer != null ) {
if (observer != null) {
getContext().getContentResolver().unregisterContentObserver(observer);
observer = null;
}
}

Expand Down

0 comments on commit 3a34e75

Please sign in to comment.