Ported: Check for null when retrieving clip data item text on Android - madmiraal

fe60de2c6a
This commit is contained in:
Relintai 2022-07-27 14:28:26 +02:00
parent 957fcb67b1
commit 02eef8fc57

View File

@ -792,14 +792,13 @@ public class Pandemonium extends Fragment implements SensorEventListener, IDownl
}
public String getClipboard() {
String copiedText = "";
if (mClipboard.hasPrimaryClip()) {
ClipData.Item item = mClipboard.getPrimaryClip().getItemAt(0);
copiedText = item.getText().toString();
}
return copiedText;
ClipData clipData = mClipboard.getPrimaryClip();
if (clipData == null)
return "";
CharSequence text = clipData.getItemAt(0).getText();
if (text == null)
return "";
return text.toString();
}
public void setClipboard(String p_text) {