There is a blockchain parameter mine-empty-blocks which determines whether or not nodes should mine blocks if there are no pending unconfirmed transactions. Note for a number of reasons this is not implemented as a consensus rule, so an individual node can override this behavior if it wishes to, and other nodes won't reject the empty blocks.