Fixes potential index out of bounds when sharing

This commit is contained in:
tom79 2017-10-09 19:24:21 +02:00
parent 9901dacf8a
commit d6e5c6d60d
2 changed files with 4 additions and 2 deletions

View File

@ -828,7 +828,8 @@ public class MainActivity extends AppCompatActivity
while (matcher.find()){
int matchStart = matcher.start(1);
int matchEnd = matcher.end();
sharedText = sharedText.substring(matchStart, matchEnd);
if(matchStart < matchEnd && sharedText.length() > matchEnd)
sharedText = sharedText.substring(matchStart, matchEnd);
}
new RetrieveMetaDataAsyncTask(sharedText, MainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
Intent intentToot = new Intent(getApplicationContext(), TootActivity.class);

View File

@ -836,7 +836,8 @@ public class MainActivity extends AppCompatActivity
while (matcher.find()){
int matchStart = matcher.start(1);
int matchEnd = matcher.end();
sharedText = sharedText.substring(matchStart, matchEnd);
if(matchStart < matchEnd && sharedText.length() > matchEnd)
sharedText = sharedText.substring(matchStart, matchEnd);
}
new RetrieveMetaDataAsyncTask(sharedText, MainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
Intent intentToot = new Intent(getApplicationContext(), TootActivity.class);