Repository: sympy/sympy

Issue:
NoneType error when attempting to manualintegrate trigonometric expression
I am attempting to use manualintegrate on expressions in the form of: 

`manualintegrate.manualintegrate(sin(x)*cos(x)**n, x)`

I have found that when n > 4 and is odd that I get either:

- TypeError: 'NoneType' object is not iterable
- or ValueError: Cannot evaluate rule None

I seem to get the TypeError when I first try n=5 and the ValueError on subsequent calls

Tracebacks can be found at: [https://paste.ee/p/jdKMU](https://paste.ee/p/jdKMU)

**Environment**
Python 3.6.2
Sympy 1.1.1

Discussion:

Patch:
diff --git a/sympy/integrals/manualintegrate.py b/sympy/integrals/manualintegrate.py
index ec3c8bd004..02e0f64a0d 100644
--- a/sympy/integrals/manualintegrate.py
+++ b/sympy/integrals/manualintegrate.py
@@ -322,10 +322,9 @@ def make_inverse_trig(RuleClass, base_exp, a, sign_a, b, sign_b):
 
 def add_rule(integral):
     integrand, symbol = integral
-    return AddRule(
-        [integral_steps(g, symbol)
-         for g in integrand.as_ordered_terms()],
-        integrand, symbol)
+    results = [integral_steps(g, symbol)
+              for g in integrand.as_ordered_terms()]
+    return None if None in results else AddRule(results, integrand, symbol)
 
 def mul_rule(integral):
     integrand, symbol = integral


Test patch:
diff --git a/sympy/integrals/tests/test_manual.py b/sympy/integrals/tests/test_manual.py
index e848ef1412..b26858d3e5 100644
--- a/sympy/integrals/tests/test_manual.py
+++ b/sympy/integrals/tests/test_manual.py
@@ -324,3 +324,7 @@ def test_issue_12899():
 
 def test_constant_independent_of_symbol():
     assert manualintegrate(Integral(y, (x, 1, 2)), x) == x*Integral(y, (x, 1, 2))
+
+
+def test_issue_13297():
+    assert manualintegrate(sin(x) * cos(x)**5, x) == -cos(x)**6 / 6