fix: catch clipboard exceptions
This commit is contained in:
parent
8265b1518c
commit
d7c10595c7
|
@ -125,7 +125,7 @@ namespace Glamaholic.Ui {
|
|||
|
||||
if (ImGui.BeginMenu("Import")) {
|
||||
if (ImGui.MenuItem("Clipboard")) {
|
||||
var json = ImGui.GetClipboardText();
|
||||
var json = Util.GetClipboardText();
|
||||
try {
|
||||
var plate = JsonConvert.DeserializeObject<SharedPlate>(json);
|
||||
if (plate != null) {
|
||||
|
@ -138,9 +138,9 @@ namespace Glamaholic.Ui {
|
|||
}
|
||||
}
|
||||
|
||||
var validUrl = IsValidEorzeaCollectionUrl(ImGui.GetClipboardText());
|
||||
var validUrl = IsValidEorzeaCollectionUrl(Util.GetClipboardText());
|
||||
if (ImGui.MenuItem("Copied Eorzea Collection URL", validUrl) && !this._ecImporting) {
|
||||
this.ImportEorzeaCollection(ImGui.GetClipboardText());
|
||||
this.ImportEorzeaCollection(Util.GetClipboardText());
|
||||
}
|
||||
|
||||
ImGui.EndMenu();
|
||||
|
|
|
@ -166,5 +166,13 @@ namespace Glamaholic {
|
|||
ImGui.TextUnformatted(icon.ToIconString());
|
||||
ImGui.PopFont();
|
||||
}
|
||||
|
||||
internal static string GetClipboardText() {
|
||||
try {
|
||||
return ImGui.GetClipboardText();
|
||||
} catch (Exception) {
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue