Browse Source

Fix null pointer deref (#166)

Sang Kil Cha 6 years ago
parent
commit
c9d7df13fd
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Terminal.Gui/Views/TextField.cs

+ 3 - 1
Terminal.Gui/Views/TextField.cs

@@ -268,8 +268,10 @@ namespace Terminal.Gui {
 				break;
 				break;
 
 
 			case Key.ControlY: // Control-y, yank
 			case Key.ControlY: // Control-y, yank
+				if (Clipboard.Contents == null)
+					return true;
 				var clip = TextModel.ToRunes (Clipboard.Contents);
 				var clip = TextModel.ToRunes (Clipboard.Contents);
-				if (clip== null)
+				if (clip == null)
 					return true;
 					return true;
 
 
 				if (point == text.Count) {
 				if (point == text.Count) {