mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 13:33:27 -07:00
BUG-2109: Fix for NPE
This commit is contained in:
parent
0b2cbe1c0b
commit
5d50cd8b96
1 changed files with 14 additions and 3 deletions
|
@ -272,8 +272,11 @@ namespace Greenshot.Drawing
|
||||||
_parent.Controls.Add(_textBox);
|
_parent.Controls.Add(_textBox);
|
||||||
}
|
}
|
||||||
EnsureTextBoxContrast();
|
EnsureTextBoxContrast();
|
||||||
_textBox.Show();
|
if (_textBox != null)
|
||||||
_textBox.Focus();
|
{
|
||||||
|
_textBox.Show();
|
||||||
|
_textBox.Focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -281,6 +284,10 @@ namespace Greenshot.Drawing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void EnsureTextBoxContrast()
|
private void EnsureTextBoxContrast()
|
||||||
{
|
{
|
||||||
|
if (_textBox == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
Color lc = GetFieldValueAsColor(FieldType.LINE_COLOR);
|
Color lc = GetFieldValueAsColor(FieldType.LINE_COLOR);
|
||||||
if (lc.R > 203 && lc.G > 203 && lc.B > 203)
|
if (lc.R > 203 && lc.G > 203 && lc.B > 203)
|
||||||
{
|
{
|
||||||
|
@ -295,7 +302,7 @@ namespace Greenshot.Drawing
|
||||||
private void HideTextBox()
|
private void HideTextBox()
|
||||||
{
|
{
|
||||||
_parent.Focus();
|
_parent.Focus();
|
||||||
_textBox.Hide();
|
_textBox?.Hide();
|
||||||
_parent.KeysLocked = false;
|
_parent.KeysLocked = false;
|
||||||
_parent.Controls.Remove(_textBox);
|
_parent.Controls.Remove(_textBox);
|
||||||
}
|
}
|
||||||
|
@ -424,6 +431,10 @@ namespace Greenshot.Drawing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void UpdateTextBoxPosition()
|
private void UpdateTextBoxPosition()
|
||||||
{
|
{
|
||||||
|
if (_textBox == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
|
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
|
||||||
|
|
||||||
int lineWidth = (int)Math.Floor(lineThickness / 2d);
|
int lineWidth = (int)Math.Floor(lineThickness / 2d);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue