I have this piece of code:
int fundID = 28;
var investorData = from investor in db.Investors
                   join loanapp in db.LoanApplications
                       on investor.FundID equals loanapp.FundID into loanAppData
                   from lapp in loanAppData.DefaultIfEmpty()
                   join fundreport in db.FundReportLoanDatas
                       on lapp.LoanId equals fundreport.LoanId into fundReportData
                   from freport in fundReportData.DefaultIfEmpty()
                   where investor.FundID == fundID
                   select new InvestorPortfolioVM()
                   {
                       InvestorId = investor.InvestorID,
                       Investment = investor.FundFraction == 0 || freport.CurrentLB == null ? null : investor.FundFraction * (Double)freport.CurrentLB,
                       TotalLoan = freport.CurrentLB == null ? 0 : freport.CurrentLB,
                       PercFundsCommitted = investor.FundsCommitted == 0 || freport.CurrentLB == null ? null : freport.CurrentLB / investor.FundsCommitted,
                       PercFundsInvested = investor.FundsInvested == 0 || freport.CurrentLB == null ? null : freport.CurrentLB / investor.FundsInvested,
                       CurrentLTV = freport.CurrentLTV == null ? 0.0 : freport.CurrentLTV,
                       LoanId = lapp.LoanId,
                       SegLTV = freport.SegLTV == string.Empty ? "" : freport.SegLTV
                   };
Whenever I'm using the int variable fundID in the where clause I'm getting NullReferenceException, but when I'm writing directly where investor.FundID == 28 I'm able to get the results as expected. 
What do I need to change in order to make the query work properly?