There is an implicit binary choice here, so "whether" fits. Both work, although I, for one, prefer to use "whether" for binary choices and "if" when there are more options. This is similar to my preference for "between" only for two things and "among" for more than two.