Check for null when retrieving clip data item text on Android
(cherry picked from commit 5924e2b90e
)
This commit is contained in:
parent
92256df9fb
commit
fe60de2c6a
@ -789,14 +789,13 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
||||
}
|
||||
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user