If replacing a null mobject, just scale by 0

This commit is contained in:
Grant Sanderson 2021-01-07 11:49:03 -08:00
parent 5939f24cd4
commit c2b5595fae

View file

@ -5,6 +5,7 @@ import operator as op
import random import random
import sys import sys
import moderngl import moderngl
import logging
import numpy as np import numpy as np
@ -580,7 +581,7 @@ class Mobject(object):
def replace(self, mobject, dim_to_match=0, stretch=False): def replace(self, mobject, dim_to_match=0, stretch=False):
if not mobject.get_num_points() and not mobject.submobjects: if not mobject.get_num_points() and not mobject.submobjects:
raise Warning("Attempting to replace mobject with no points") self.scale(0)
return self return self
if stretch: if stretch:
for i in range(self.dim): for i in range(self.dim):