NotificationLightSettings: Fix NPE when led pulse not supported

Log:
time: 1657880251236
msg: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.preference.Preference.setOnPreferenceClickListener(androidx.preference.Preference$OnPreferenceClickListener)' on a null object reference
stacktrace: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.preference.Preference.setOnPreferenceClickListener(androidx.preference.Preference$OnPreferenceClickListener)' on a null object reference
	at com.crdroid.settings.fragments.notifications.notificationlight.NotificationLightSettings.onActivityCreated(NotificationLightSettings.java:200)
	at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2986)
	at androidx.fragment.app.FragmentStateManager.activityCreated(FragmentStateManager.java:556)
	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
	at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
	at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1667)
	at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3234)
	at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:3178)
	at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:251)
	at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:473)
	at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1473)
	at android.app.Activity.performStart(Activity.java:8082)
	at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3687)
	at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
	at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2242)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7833)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Change-Id: I30afcbab23156bd4a8d3394a00262c1583dc1dbe
diff --git a/src/org/lineageos/lineageparts/notificationlight/NotificationLightSettings.java b/src/org/lineageos/lineageparts/notificationlight/NotificationLightSettings.java
index f0af664..1c3092d 100644
--- a/src/org/lineageos/lineageparts/notificationlight/NotificationLightSettings.java
+++ b/src/org/lineageos/lineageparts/notificationlight/NotificationLightSettings.java
@@ -177,14 +177,20 @@
         } else {
             mApplicationPrefList = findPreference(APPLICATION_SECTION);
             mApplicationPrefList.setOrderingAsAdded(false);
+
+            // Get launch-able applications
+            mPackageManager = getActivity().getPackageManager();
+            mPackageAdapter = new PackageListAdapter(getActivity());
+
+            mPackages = new HashMap<String, Package>();
+
+            Preference addPreference = prefSet.findPreference(ADD_APPS);
+            addPreference.setOnPreferenceClickListener(preference -> {
+                showDialog(DIALOG_APPS);
+                return true;
+            });
         }
 
-        // Get launch-able applications
-        mPackageManager = getActivity().getPackageManager();
-        mPackageAdapter = new PackageListAdapter(getActivity());
-
-        mPackages = new HashMap<String, Package>();
-
         if (!mMultiColorLed) {
             resetColors();
             mGeneralPrefs.removePreference(mAutoGenerateColors);
@@ -194,12 +200,6 @@
         }
 
         watch(Settings.System.getUriFor(Settings.System.NOTIFICATION_LIGHT_PULSE));
-
-        Preference addPreference = prefSet.findPreference(ADD_APPS);
-        addPreference.setOnPreferenceClickListener(preference -> {
-            showDialog(DIALOG_APPS);
-            return true;
-        });
     }
 
     @Override