This fails when you call rebase from a RepositoryNode (i.e. a "Repository" node from the repo view; in this case, ref should simply be null; doing something like 

if (node.getType() == RepositoryTreeNodeType.Ref)
ref = ((RefNode)...
else
ref = null;

should do the job.