fix compile warning (assignment inside if)
fix HasExtension didn't necessarily terminate correctly
Merge pull request #3506 from jmarshallnz/compile_warnings

Compile warnings