private Symbol getSymbol(Program program) {

		if (existingSymbol != null) {
			return existingSymbol;
		}

		SymbolTable st = program.getSymbolTable();
		Symbol s = null;
		if (oldName != null) {
			s = st.getSymbol(oldName, addr, currentNamespace);
		}
		else {
			s = st.getPrimarySymbol(addr);
			if (s != null && !s.isDynamic()) {
				// noted by the constructor, a null name can only be used to rename dynamic symbols
				errorMessage = "Must specify name of symbol to be renamed";
				return null;
			}
		}

		if (s == null) {
			errorMessage = "Symbol not found: " + oldName;
			return null;
		}
		return s;
	}
Constructs a new command for renaming a label within currentNamespace and changing the
namespace to newNamespace.

@param addr Address of label to be renamed
@param oldName the current name of the label to be renamed
@param newName the new name for the label. (null for default)
@param currentNamespace the symbol's current parent name space; null for global namespace
@param newNamespace the desired namespace; null for global namespace
@param source the source of this symbol
Ghidra/Features/Base/src/main/java/ghidra/app/cmd/label/RenameLabelCmd.java