Skip to content

Commit 85bc704

Browse files
author
DrKLO
committed
Crash fixes
1 parent f63c8b2 commit 85bc704

File tree

10 files changed

+45
-20
lines changed

10 files changed

+45
-20
lines changed

TMessagesProj/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ android {
8282
defaultConfig {
8383
minSdkVersion 8
8484
targetSdkVersion 21
85-
versionCode 453
86-
versionName "2.5.0"
85+
versionCode 454
86+
versionName "2.5.1"
8787
}
8888
}

TMessagesProj/src/main/java/org/telegram/android/SecretChatHelper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,10 @@ public void onClick(DialogInterface dialog, int which) {
17771777
}
17781778
}
17791779
});
1780-
progressDialog.show();
1780+
try {
1781+
progressDialog.show();
1782+
} catch (Exception e) {
1783+
//don't promt
1784+
}
17811785
}
17821786
}

TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ public void showAtLocation(View parent, int gravity, int x, int y) {
200200
@Override
201201
public void dismiss() {
202202
setFocusable(false);
203-
super.dismiss();
203+
try {
204+
super.dismiss();
205+
} catch (Exception e) {
206+
//don't promt
207+
}
204208
unregisterListener();
205209
}
206210
}

TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,14 +603,19 @@ public void buildLayout() {
603603
public void checkCurrentDialogIndex() {
604604
TLRPC.TL_dialog dialog = null;
605605
if (isServerOnly) {
606-
dialog = MessagesController.getInstance().dialogsServerOnly.get(index);
606+
if (index < MessagesController.getInstance().dialogsServerOnly.size()) {
607+
dialog = MessagesController.getInstance().dialogsServerOnly.get(index);
608+
}
607609
} else {
608-
dialog = MessagesController.getInstance().dialogs.get(index);
610+
if (index < MessagesController.getInstance().dialogs.size()) {
611+
dialog = MessagesController.getInstance().dialogs.get(index);
612+
}
609613
}
610-
boolean update = true;
611-
if (currentDialogId != dialog.id || message != null && message.messageOwner.id != dialog.top_message || unreadCount != dialog.unread_count) {
612-
currentDialogId = dialog.id;
613-
update(0);
614+
if (dialog != null) {
615+
if (currentDialogId != dialog.id || message != null && message.messageOwner.id != dialog.top_message || unreadCount != dialog.unread_count) {
616+
currentDialogId = dialog.id;
617+
update(0);
618+
}
614619
}
615620
}
616621

TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,11 @@ public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleI
13071307
progressView.setLayoutParams(layoutParams3);
13081308

13091309
ProgressBar progressBar = new ProgressBar(getParentActivity());
1310-
progressBar.setIndeterminateDrawable(getParentActivity().getResources().getDrawable(R.drawable.loading_animation));
1310+
try {
1311+
progressBar.setIndeterminateDrawable(getParentActivity().getResources().getDrawable(R.drawable.loading_animation));
1312+
} catch (Exception e) {
1313+
//don't promt
1314+
}
13111315
progressBar.setIndeterminate(true);
13121316
AndroidUtilities.setProgressBarAnimationDuration(progressBar, 1500);
13131317
progressView.addView(progressBar);

TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,11 @@ public void onEmojiSelected(String symbol) {
854854
emojiButton.setImageResource(R.drawable.ic_msg_panel_smiles);
855855
}
856856
if (emojiPopup != null) {
857-
emojiPopup.dismiss();
857+
try {
858+
emojiPopup.dismiss();
859+
} catch (Exception e) {
860+
//don't promt
861+
}
858862
}
859863
if (sizeNotifierRelativeLayout != null) {
860864
sizeNotifierRelativeLayout.post(new Runnable() {

TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoFilterView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,7 @@ public void init() {
14461446
}
14471447

14481448
public Bitmap getBitmap() {
1449-
return eglThread.getTexture();
1449+
return eglThread != null ? eglThread.getTexture() : null;
14501450
}
14511451

14521452
private void fixLayout(int viewWidth, int viewHeight) {

TMessagesProj/src/main/java/org/telegram/ui/PasscodeActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ private void updateDropDownTextView() {
488488
filterArray[0] = new InputFilter.LengthFilter(4);
489489
passwordEditText.setFilters(filterArray);
490490
passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE);
491-
passwordEditText.setKeyListener(DigitsKeyListener.getInstance("123456789"));
491+
passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890"));
492492
} else if (type == 1 && currentPasswordType == 1 || type == 2 && UserConfig.passcodeType == 1) {
493493
passwordEditText.setFilters(new InputFilter[0]);
494494
passwordEditText.setKeyListener(null);

TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -972,13 +972,15 @@ private void updateUserData() {
972972
}
973973
AvatarDrawable avatarDrawable = new AvatarDrawable(user, true);
974974
avatarDrawable.setColor(0xff5c98cd);
975-
avatarImage.setImage(photo, "50_50", avatarDrawable);
976-
avatarImage.imageReceiver.setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
975+
if (avatarImage != null) {
976+
avatarImage.setImage(photo, "50_50", avatarDrawable);
977+
avatarImage.imageReceiver.setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
977978

978-
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
979-
onlineTextView.setText(LocaleController.getString("Online", R.string.Online));
979+
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
980+
onlineTextView.setText(LocaleController.getString("Online", R.string.Online));
980981

981-
avatarImage.imageReceiver.setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
982+
avatarImage.imageReceiver.setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
983+
}
982984
}
983985

984986
private void sendLogs() {

TMessagesProj/src/main/java/org/telegram/ui/WallpapersActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,9 @@ public void run() {
419419
wallPapers.add((TLRPC.WallPaper)obj);
420420
wallpappersByIds.put(((TLRPC.WallPaper)obj).id, (TLRPC.WallPaper)obj);
421421
}
422-
listAdapter.notifyDataSetChanged();
422+
if (listAdapter != null) {
423+
listAdapter.notifyDataSetChanged();
424+
}
423425
if (backgroundImage != null) {
424426
processSelectedBackground();
425427
}

0 commit comments

Comments
 (0)