diff --git a/pre_commit_hooks/mixed_line_ending.py b/pre_commit_hooks/mixed_line_ending.py
index 301c654..a163726 100644
--- a/pre_commit_hooks/mixed_line_ending.py
+++ b/pre_commit_hooks/mixed_line_ending.py
@@ -55,7 +55,8 @@ def fix_filename(filename, fix):
     else:
         target_ending = FIX_TO_LINE_ENDING[fix]
         # find if there are lines with *other* endings
-        del counts[target_ending]
+        # It's possible there's no line endings of the target type
+        counts.pop(target_ending, None)
         other_endings = bool(sum(counts.values()))
         if other_endings:
             _fix(filename, contents, target_ending)

diff --git a/tests/mixed_line_ending_test.py b/tests/mixed_line_ending_test.py
index 808295b..23837cd 100644
--- a/tests/mixed_line_ending_test.py
+++ b/tests/mixed_line_ending_test.py
@@ -101,3 +101,13 @@ def test_fix_crlf(tmpdir):
 
     assert ret == 1
     assert path.read_binary() == b'foo\r\nbar\r\nbaz\r\n'
+
+
+def test_fix_lf_all_crlf(tmpdir):
+    """Regression test for #239"""
+    path = tmpdir.join('input.txt')
+    path.write_binary(b'foo\r\nbar\r\n')
+    ret = main(('--fix=lf', path.strpath))
+
+    assert ret == 1
+    assert path.read_binary() == b'foo\nbar\n'

mixed-line-ending -- KeyError: b'\n'
`pre-commit 1.1.2`

```bash
Mixed line ending........................................................Failed
hookid: mixed-line-ending

Traceback (most recent call last):
  File "/home/gary/.cache/pre-commit/repos71slzol/py_env-python3.6/bin/mixed-line-ending", line 11, in <module>
    load_entry_point('pre-commit-hooks==0.9.4', 'console_scripts', 'mixed-line-ending')()
  File "/home/gary/.cache/pre-commit/repos71slzol/py_env-python3.6/lib/python3.6/site-packages/pre_commit_hooks/mixed_line_ending.py", line 78, in main
    retv |= fix_filename(filename, args.fix)
  File "/home/gary/.cache/pre-commit/repos71slzol/py_env-python3.6/lib/python3.6/site-packages/pre_commit_hooks/mixed_line_ending.py", line 58, in fix_filename
    del counts[target_ending]
KeyError: b'\n'
```
```yaml
-   repo: git://github.com/pre-commit/pre-commit-hooks
    sha: v0.9.4
    hooks:
    -   id: mixed-line-ending
        args: [--fix=lf]
```


tests/mixed_line_ending_test.py::test_fix_lf_all_crlf
tests/mixed_line_ending_test.py::test_mixed_line_ending_fixes_auto[foo\r\nbar\nbaz\n-foo\nbar\nbaz\n] tests/mixed_line_ending_test.py::test_mixed_line_ending_fixes_auto[foo\r\nbar\nbaz\r\n-foo\r\nbar\r\nbaz\r\n] tests/mixed_line_ending_test.py::test_mixed_line_ending_fixes_auto[foo\rbar\nbaz\r-foo\rbar\rbaz\r] tests/mixed_line_ending_test.py::test_mixed_line_ending_fixes_auto[foo\r\nbar\n-foo\nbar\n] tests/mixed_line_ending_test.py::test_mixed_line_ending_fixes_auto[foo\rbar\n-foo\nbar\n] tests/mixed_line_ending_test.py::test_mixed_line_ending_fixes_auto[foo\r\nbar\r-foo\r\nbar\r\n] tests/mixed_line_ending_test.py::test_mixed_line_ending_fixes_auto[foo\r\nbar\nbaz\r-foo\nbar\nbaz\n] tests/mixed_line_ending_test.py::test_non_mixed_no_newline_end_of_file tests/mixed_line_ending_test.py::test_mixed_no_newline_end_of_file tests/mixed_line_ending_test.py::test_line_endings_ok[--fix=auto-foo\r\nbar\r\nbaz\r\n] tests/mixed_line_ending_test.py::test_line_endings_ok[--fix=auto-foo\rbar\rbaz\r] tests/mixed_line_ending_test.py::test_line_endings_ok[--fix=auto-foo\nbar\nbaz\n] tests/mixed_line_ending_test.py::test_line_endings_ok[--fix=crlf-foo\r\nbar\r\nbaz\r\n] tests/mixed_line_ending_test.py::test_line_endings_ok[--fix=lf-foo\nbar\nbaz\n] tests/mixed_line_ending_test.py::test_no_fix_does_not_modify tests/mixed_line_ending_test.py::test_fix_lf tests/mixed_line_ending_test.py::test_fix_crlf