Fixes potential index out of bounds when sharing
This commit is contained in:
parent
9901dacf8a
commit
d6e5c6d60d
|
@ -828,7 +828,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
while (matcher.find()){
|
while (matcher.find()){
|
||||||
int matchStart = matcher.start(1);
|
int matchStart = matcher.start(1);
|
||||||
int matchEnd = matcher.end();
|
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);
|
new RetrieveMetaDataAsyncTask(sharedText, MainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
Intent intentToot = new Intent(getApplicationContext(), TootActivity.class);
|
Intent intentToot = new Intent(getApplicationContext(), TootActivity.class);
|
||||||
|
|
|
@ -836,7 +836,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
while (matcher.find()){
|
while (matcher.find()){
|
||||||
int matchStart = matcher.start(1);
|
int matchStart = matcher.start(1);
|
||||||
int matchEnd = matcher.end();
|
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);
|
new RetrieveMetaDataAsyncTask(sharedText, MainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
Intent intentToot = new Intent(getApplicationContext(), TootActivity.class);
|
Intent intentToot = new Intent(getApplicationContext(), TootActivity.class);
|
||||||
|
|
Loading…
Reference in New Issue