Add nullness check of CacheBuilder

Add a check of whether the CacheBuilder arguments are null so that we won't get NullPointerException when the solver is run in DEBUG mode without CacheBuilder.