Disabling script

Okay, at first, sorry for bad English.
Hello guys, I have problem with disabling script.

using UnityEngine;
using System.Collections;

public class DestroyManager : MonoBehaviour { 
    public GameObject object1, object2;
    SpawnManager spawnmanager; // spawning script

    void Awake () {
        spawnmanager = GetComponent<SpawnManager> ();
    }
   
    // Update is called once per frame
    void Update () {
        if (!object1) {
            // some operators
            spawnmanager.enabled = false;
        }
        if (!object2) {
            // some operators
            spawnmanager.enabled = false; 
        }         /*After destroying one of objects, the SpawningScript still works, and there are an error in console:
                  
NullReferenceException: Object reference not set to an instance of an object
DestroyManager.Update () (at Assets/Scripts/DestroyManager.cs:21)*/

    }
}

What’s the matter???

You should also check

if(spawnmanager) {
    spawnmanager.enabled = false;
}

Yep, now no errors, but script still works. It must disable.