fix edit channel crash

This commit is contained in:
Akinwale Ariwodola 2020-05-22 04:57:40 +01:00
parent 528f81c59a
commit 616e3597db
2 changed files with 6 additions and 3 deletions

View file

@ -349,13 +349,15 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}); });
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
castContext = CastContext.getSharedInstance(this);
dbHelper = new DatabaseHelper(this); dbHelper = new DatabaseHelper(this);
checkNotificationOpenIntent(getIntent()); checkNotificationOpenIntent(getIntent());
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
// TODO: Check Google Play Services availability
// castContext = CastContext.getSharedInstance(this);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.content_main), new OnApplyWindowInsetsListener() { ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.content_main), new OnApplyWindowInsetsListener() {
@Override @Override
public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {

View file

@ -289,11 +289,12 @@ public class ChannelFormFragment extends BaseFragment implements
} }
private void validateAndSaveClaim(Claim claim) { private void validateAndSaveClaim(Claim claim) {
String channelName = claim.getName().startsWith("@") ? claim.getName().substring(1) : claim.getName(); if (Helper.isNullOrEmpty(claim.getName())) {
if (Helper.isNullOrEmpty(channelName)) {
showError(getString(R.string.please_enter_channel_name)); showError(getString(R.string.please_enter_channel_name));
return; return;
} }
String channelName = claim.getName().startsWith("@") ? claim.getName().substring(1) : claim.getName();
if (!LbryUri.isNameValid(channelName)) { if (!LbryUri.isNameValid(channelName)) {
showError(getString(R.string.channel_name_invalid_characters)); showError(getString(R.string.channel_name_invalid_characters));
return; return;