Skip to content

Commit

Permalink
Fixed bug 6 at Google Code
Browse files Browse the repository at this point in the history
When a snippet started with an empty line Validate()
returned false because only the first line was checked.
  • Loading branch information
ffes committed Mar 13, 2015
1 parent 75a2a52 commit e8c5175
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions DlgEditSnippet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@ static void CleanItems(HWND hDlg)

static bool Validate(HWND hDlg)
{
// Check required fields
// Check if name is entered
if (SendMessage(GetDlgItem(hDlg, IDC_NAME), EM_LINELENGTH, 0, 0) == 0)
{
MsgBox("Name needs to be entered!");
return false;
}

//
if (SendMessage(GetDlgItem(hDlg, IDC_BEFORE_SEL), EM_LINELENGTH, 0, 0) == 0)
// Get the text entered as "Before Selection"
WCHAR* before = GetDlgText(hDlg, IDC_BEFORE_SEL);
if (before == NULL)
{
MsgBox("Before Selection needs to be entered!");
return false;
}
delete before;

return true;
}
Expand Down

0 comments on commit e8c5175

Please sign in to comment.