fixing cosmetic changes suggested by code review
add null check after m_encoder new