From 26bdf7e82fdd7a220de493edb7bff06f7710a54e Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 26 Oct 2018 17:46:11 -0400 Subject: [PATCH] Bug 540523 - NullPointerException in MesonPropertyPage.performOk method - add check that buildConfig field has been set before performing any activities on it Change-Id: If3ab7a0b20b54a9c16b26902c06b615e4c514ffa (cherry picked from commit 903109039312886e637a4599a67ffec3298ef64a) --- .../meson/ui/properties/MesonPropertyPage.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java b/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java index ec013937024..8e4dea77e1c 100644 --- a/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java +++ b/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java @@ -299,16 +299,18 @@ public class MesonPropertyPage extends PropertyPage { return false; } } else { - StringBuilder mesonargs = new StringBuilder(); - for (IMesonPropertyPageControl control : componentList) { - if (!control.getUnconfiguredString().isEmpty()) { - mesonargs.append(control.getUnconfiguredString()); - mesonargs.append(" "); //$NON-NLS-1$ + if (buildConfig != null) { + StringBuilder mesonargs = new StringBuilder(); + for (IMesonPropertyPageControl control : componentList) { + if (!control.getUnconfiguredString().isEmpty()) { + mesonargs.append(control.getUnconfiguredString()); + mesonargs.append(" "); //$NON-NLS-1$ + } } + buildConfig.setProperty(IMesonConstants.MESON_ARGUMENTS, mesonargs.toString()); + buildConfig.setProperty(IMesonConstants.MESON_ENV, envText.getText().trim()); + buildConfig.setProperty(IMesonConstants.MESON_PROJECT_OPTIONS, projText.getText().trim()); } - buildConfig.setProperty(IMesonConstants.MESON_ARGUMENTS, mesonargs.toString()); - buildConfig.setProperty(IMesonConstants.MESON_ENV, envText.getText().trim()); - buildConfig.setProperty(IMesonConstants.MESON_PROJECT_OPTIONS, projText.getText().trim()); } return true; }